Last active
April 19, 2017 05:45
-
-
Save majido/7e542e5af9ef090ba0ab7584316f235d to your computer and use it in GitHub Desktop.
Some ideas!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
animationWorklet.import('twitter-header-animator.js').then( _ => { | |
var anim = new WorkletAnimation('twitter-header', | |
[document.timeline, new ScrollingTimeline(scrollingElement, {/* options for timeline */})], | |
{ | |
targets : { | |
bar: element1, | |
avatar: [element2, element3], | |
}, | |
timing: { | |
duration: ....??? | |
} | |
}); | |
} | |
//In animation worklet | |
registerAnimator('twitter-header', class { | |
const easing = new EaseOutTiming(); | |
animate(timelines, targets) { | |
const time = timelines[0].currentTime; // [0...timeRange] | |
const progress = time / range; | |
targets.get("bar")[0].outputStuleMap.set("opacity", easing.value(progress)) | |
targets.get("avatar").forEach(avatar => { | |
avator.outputStuleMap.set("opacity", progress); | |
}) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment