Comments (8)
(If I had to take a stab, my best guess is so transitions are pure and thus can be reused.)
My use case at the moment (for which I'm trying to think through a better solution) is clicking an item in a list. Doing that reshuffles the list, so all sprites are keptSprites
, but I want the clickedItem
to be animated in a slightly different way from the others. I'm having trouble figuring out how to do that.
from ember-animated.
Right, they are functions, not methods. You can manually bind them if you want to, like any function.
export default Component.extend({
init() {
this._super.init();
this.transition = this.transition.bind(this);
},
foo: 'bar',
* transition({ keptSprites }) {
console.log(this);
keptSprites.forEach(sprite => {
from ember-animated.
I see... is that considered a bad practice?
from ember-animated.
I might still be "thinking in D3" but I think my higher-level question is how to "link" Sprites with the objects/data that's driving them.
Simple demo I'm hacking on:
Clicking an item changes its position
property and the list resorts. What if I want to do something "special" to the clicked item? Basically if I bound my transition function in init, maybe I could use some data-item-id
attr on the dom element to look up the correct item from the this.items
array, and use that to affect the animation. But it almost feels like there should be a direct way to "bind" some data to a Sprite.
from ember-animated.
I don't think it's bad.
We could choose to introduce sprite.model
. There is a user-provided model backing every sprite, it's just not exposed in the API today.
from ember-animated.
There is a user-provided model backing every sprite
Could you elaborate?
from ember-animated.
Is it the predicate
, the thing that is changing that is triggering a Sprite to animate?
from ember-animated.
Yes, it's the value that's yielded into the block. For animated-if it's just the value of the predicate, but for a-value or a-each it's the value of the actual item.
from ember-animated.
Related Issues (20)
- [DOCS] Initial homepage for ember-animated has too much whitespace between lines HOT 1
- Embroider Compatibility: animated-container's dynamic Tag breaks build HOT 3
- Information on testing ember-animated in docs HOT 2
- Why do we need `assert-never` in `dependencies`? HOT 2
- Ember Global deprecation warning due to old version of ember-cli-babel in ember-animated HOT 2
- Consider public export of TransitionContext type HOT 1
- Attempted to resolve -element, which was expected to be a helper, but nothing was found HOT 5
- Embroider: ember-animated is trying to import from rsvp but that is not one of its explicit dependencies HOT 1
- 1.x breaks animated-outlet HOT 10
- TypeError: yield* (intermediate value)(intermediate value) is not iterable after removing IE11 from transpilation targets HOT 1
- `startTranslatedBy` and `endTranslatedBy` modify the initial and final bounds width/height
- AnimatedOrphans' documentation looks broken HOT 2
- Memory leak in emberAnimatedSingleton HOT 6
- Incompatibility with ember-element-helper v0.6.1 and Embroider optimized HOT 8
- Types are not resolveable with sufficiently new enough TypeScript
- Error after upgrade from `1.0.4` to `1.1.0` HOT 3
- Glint ember-animated/template-registry not found HOT 2
- v1.1.3 is missing type declarations HOT 4
- Documentation code examples rendering wrong
- App broken after upgrade from 2.0.0 to 2.0.1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-animated.