Skip to content

Instantly share code, notes, and snippets.

@dcporter
Created September 27, 2013 13:48
Show Gist options
  • Save dcporter/6728858 to your computer and use it in GitHub Desktop.
Save dcporter/6728858 to your computer and use it in GitHub Desktop.
Fun With Transitions: ImageView that fades in on load.
/*
View Transitions, new in SC1.0, have made all kinds of effects drop-dead easy. Here's
an ImageView which will fade nicely in when the image loads.
*/
FadingImageView = SC.ImageView.extend({
isVisible: NO,
isVisibleBinding: SC.Binding.oneWay('.status').transform(function(status) { return status === SC.IMAGE_STATE_LOADED; }),
transitionShow: SC.View.FADE_IN,
transitionShowOptions: { duration: 0.25 },
transitionHide: SC.View.FADE_OUT,
transitionHideOptions: { duration: 0.25 },
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment