I am using "onAnimationEnd" event but want to do some work when animation is progress. So I want to know current animated frame number via any progress or any event ?
Thanks for your help.
You can use the tick-event (http://www.createjs.com/Docs/EaselJS/classes/BitmapAnimation.html#event_tick) and the use the properties currentAnimation, currentAnimationFrame and/or currentFrame (http://www.createjs.com/Docs/EaselJS/classes/BitmapAnimation.html#property_currentAnimation)
Update:
Sprite now dispatches a change event whenever the displayed frame changes.
(by gskinner via comments)
Related
I am trying to implement a slider in the known slide to unlock style from older iphones to perform an action inside my swift app. The Slider should change background color and change the text inside while dragging. When the user drags til the end, the thumbView should stick to the right side and wait for a confirmation (some event) coming in to finally present a new view.
The slider should look something like this:
First state
Second state while dragging
Third state after releasing
I have found a few things on the internet but nothing that comes close to what I want to do. How would I go about doing this? My guess would be a combination of views with drag events but I feel like there must be an easier way. Any Ideas?
Maybe a UISlider with a transparent track on a rectangle view with your text and color. You can set your image as the UISlider's thumb and receive events as the value changes and when the user touches and releases it.
You can use that to for example, animate the thumb back to the start when the user releases on any place except the end of the track. Also, you can set the slider's value from 0 to 1 and use it to calculate the color, so it changes smoothly.
When the user releases on the end of the track, you activate the activity indicator and start your process to present the next view....
Even though this is a possibility, I think I'd try doing a custom control using a pan gesture. It'd give you more control and you could for example choose how the thumb image animates when going back to the start on release.... I dont' think you can do that with UISlider's setValue(animated:).
I am using $EVT_PARK to change captions but this only triggers when the slide change has completed. I would like to fade between captions during the slide movement. I can build that but need a trigger to activate when each slide change starts rather than finishes. Many thanks for any suggestions.
Please use $EVT_POSITION_CHANGE.
You will get actual position.
In the picture below, I have drawn on the element I am trying to figure out how to make. It is a cross between a UISlider and a UIProgressview. It has the style and look of a UIProgressview, but has a ...slider like a UISlider. How would I make one of these regularly? Nearly every music player has them... :|
Are you talking about the volume slider or the track progress?
If it is the volume slider, its just the normal UISlider.
And if you're talking about the track progress, then it is also a UISlider. The difference is that every time a second passes in the track, it updates the position of the slider relative to the position in the track. Then when the user slides the slider it updates the position of the track relative to the position of the slider
Hope this helps
How can a progress bar be used as a seek bar?
You want to use an UISlider. Update its position periodically according to the playing position. Adjust your playing position whenever the slider calls its action.
You should build a custom control for that.
There are tools to make this extremely easy. I don't want to do advertisement, but have a look at Opacity. There you can create vector drawings with paramters like one for the current progress value. And you can have this drawing exported as source code which will create a UIView or UIControl subclass (at your choice) that has a property to set the current progress.
At least that's the way I'd do this.
I have custom slider that I use the following touch event to respond to:
[bSlider addTarget:self action:#selector(sliderAction:) forControlEvents:UIControlEventValueChanged];
I find it very difficult to use, it does not respond to touches about 50% of the time. Compared to the volume slider with the music player that works great every time you touch it. Are there any secrets to creating a slider in code that will make it more responsive?
I had the same problem with my custom UISlider and solved it by using a larger "thumb" image with transparency around the outside.
I also had problems with my callback function running slowly and causing the slider to be very laggy and clumsy to use, which I fixed by adding a simple check at the top of the function:
int val = ceil(sliderView.value);
if (val == _lastSliderVal) return;
_lastSliderVal = val;
// .. code to update various display elements based on slider value
After changing both of these, the slider works beautifully.
The problem is the event you are tracking. UIControlEventTouchUpInside means that your -start method will only get called if you lift your finger up while it is still in the bounds of the control, something that's not easy to do on a slider.
What you probably want is UIControlEventTouchUpOutside and/or UIControlEventTouchDragExit, which will call -start either when you lift your finger outside of the control's bounds, or when your finger is dragged from within a control to outside its bounds, respectively.
See the UIControl reference for more info.
Well I tried several things including the suggestions above but never got my slider to work as well as the iPhone volume slider in the music app. The only thing that helped was to add a clear background around the button image to make the touch space larger. That created problems getting the button to slide all the way to the bottom and top of slider that I never completely resolved. Now with OS 3.0 is seems to be working much better.