Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Scripter - Pythonista UI animation framework built on ui.View.update()
-
@mikael , both your links are pointing to the raw contents of scripter.py
-
@Phuket2, thanks, fixed.
-
Syntax error in line 343
f' not supported in my Pythonista -
@cvp, as said, this relies on new update method of ui.View, which is only available in beta, but should be part of the soon-to-be-released App Store version.
-
@mikael Sorry, I had not read it correctly 😰
-
@cvp, thanks for trying and hopefully it will work for everyone soon. Or check out if you could still get the beta - I have had no hassles with it.
-
Added fly_out effect with a direction option, see demo.
-
Syntax error in line 343
f' not supported in my Pythonistaf'strings' are a Python 3.6+ feature which is why they work in the Pythonista beta but not in the App Store version.
I saw a really cool module https://github.com/asottile/future-fstrings that allows all Pythons (even 2.7!!) to do f-strings just by adding:
# -*- coding: future_fstrings -*-
as the first or second line of the file. No import or anything. Not sure if it will work in Pythonista but pretty mindbending nevertheless. -
@ccc Thanks but I'll wait for next version...
-
With some more practical experience with this I decided to change the way effects are used, to remove the need to define any classes or functions just to use simple effects.
There’s also now some proper API docs.
From the Quick Start:
Quick start
In order to start using the animation effects, just import scripter and call the effects as functions:
from scripter import * hide(my_button)
Effects expect an active UI view as the first argument. This can well be
self
orsender
where applicable.If you want to create a more complex animation from the effects provided, combine them in a
script:@script def my_script(): move(my_button, 50, 200) pulse(my_button, 'red') yield hide(my_button)
Scripts control the order of execution with
yield
statements. Here movement and a red
pulsing highlight happen at the same time. After both actions are completed,my_button
fades
away.Run scripter.py in Pythonista to see a demo of most of the available effects.
-
And courtesy of iOS 11 screen recording, here’s a video of the demo.
-
Hmm...I must be doing something wrong. Tried to run scripter.py ( to see demo) but all I get is https://imgur.com/a/na0Nx
-
@ihf, I did not test on iPad, and
present
had a wrong argument.Either download the latest or change line 539 to:
v.present('full_screen')
-
@mikael Thanks that worked! (In the version I have, it was line 552).
-
@omz, is there a way to access the various timing options in
scene
Action
as a function of t? Would like to have the option of using those in Scripter. -
See https://github.com/controversial/ui2/blob/master/ui2/animate.py
The above is mainly for ui animation. You may look at scene_drawing.py code to see how various timing options are implemented.
-
@enceladus, thanks, your answer guided me on a hunt through UIKit and SceneKit docs. I could not find the easing functions conveniently exposed by Apple.
-
scene_drawing.py in modules/standard library 3.5/site-packages. You can use curve_sinodial, curve_ease_in like functions.
-
current_func = lambda s,t,d:s+curve_sinodial(t)*d should work (I am outside and I will post the proper working code later.)
-
@enceladus, thanks! Need to test this, but looks like all of the functions there are directly useable with Scripter.