Comments (2)
Hi dannifritz/technocat!
This is completely intentional. Being able to do tween.update(dt) only in one place, and having all the tweens updated, independently of the file they were created in, is good IMHO.
This relates with how Lua's require
function works. The first time you invoke it, it reads the file you told it to read, and returns whatever it's supposed to return (a table, a function, nil, etc). Any subsequent call to require, however, will not parse the file; it has the result "cached", so it is returned directly instead of parsing the file again. So, in a way, require
is designed to created "sort of self-contained singletons". So I try to use my libs in the same way.
Besides, I think in LÖVE in particular is very convenient; you just call tween.update(dt) inside love.update and everything works.
If you wanted to have several separated tween update cycles you have to use Lua's loadfile
or LÖVE's love.filesystem.load . Both will create new closures every time their "returning chunks" is executed. In theory this will create several independent lists of tweens. But, I must warn you: I haven't designed the library with that in mind, and have not tested that behaviour. I'm pretty sure that will work. I'm not sure I'd want to use it that way though.
Best regards!
from tween.lua.
Thanks for the reply. Glad it was intentional.
And thanks for the loadfile tip!
from tween.lua.
Related Issues (16)
- Tweens using callbacks? HOT 2
- Parabolic arc HOT 2
- [suggestion] Curve-Bezier HOT 3
- Two tweens played one after the other HOT 3
- Backwards tween HOT 2
- inExpo cannot end on 'c' value HOT 3
- Issue when running demo HOT 3
- Should tweens be local? HOT 7
- Comments switched around
- Stack Traceback when running the example HOT 1
- tween not working on audio mp3 files HOT 2
- value change error
- Apparent problem with colors HOT 4
- Tween individual tweens. Maybe groups of them. HOT 2
- Delay Call 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 tween.lua.