Search Results

Search found 2528 results on 102 pages for 'animation'.

Page 12/102 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • UIView Animation won't run transition

    - by dpelletier
    So, I've searched quite a bit for this and can't seem to find a solution. This code works: CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:nil context:context]; [UIView setAnimationDuration:5]; [c setCenter:CGPointMake(200, 200)]; [UIView commitAnimations]; This code doesn't: CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:nil context:context]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:c cache:YES]; [UIView setAnimationDuration:5]; [c exchangeSubviewAtIndex:0 withSubviewAtIndex:1]; [UIView commitAnimations]; And I know the call to exchangeSubViewAtIndex is working because if I remove it from the animation block it functions as expected. Anyone have any insight as to why this transition won't run? Something I need to import?

    Read the article

  • Most efficient way to implement delta time

    - by Starkers
    Here's one way to implement delta time: /// init /// var duration = 5000, currentTime = Date.now(); // and create cube, scene, camera ect ////// function animate() { /// determine delta /// var now = Date.now(), deltat = now - currentTime, currentTime = now, scalar = deltat / duration, angle = (Math.PI * 2) * scalar; ////// /// animate /// cube.rotation.y += angle; ////// /// update /// requestAnimationFrame(render); ////// } Could someone confirm I know how it works? Here what I think is going on: Firstly, we set duration at 5000, which how long the loop will take to complete in an ideal world. With a computer that is slow/busy, let's say the animation loop takes twice as long as it should, so 10000: When this happens, the scalar is set to 2.0: scalar = deltat / duration scalar = 10000 / 5000 scalar = 2.0 We now times all animation by twice as much: angle = (Math.PI * 2) * scalar; angle = (Math.PI * 2) * 2.0; angle = (Math.PI * 4) // which is 2 rotations When we do this, the cube rotation will appear to 'jump', but this is good because the animation remains real-time. With a computer that is going too quickly, let's say the animation loop takes half as long as it should, so 2500: When this happens, the scalar is set to 0.5: scalar = deltat / duration scalar = 2500 / 5000 scalar = 0.5 We now times all animation by a half: angle = (Math.PI * 2) * scalar; angle = (Math.PI * 2) * 0.5; angle = (Math.PI * 1) // which is half a rotation When we do this, the cube won't jump at all, and the animation remains real time, and doesn't speed up. However, would I be right in thinking this doesn't alter how hard the computer is working? I mean it still goes through the loop as fast as it can, and it still has render the whole scene, just with different smaller angles! So this a bad way to implement delta time, right? Now let's pretend the computer is taking exactly as long as it should, so 5000: When this happens, the scalar is set to 1.0: angle = (Math.PI * 2) * scalar; angle = (Math.PI * 2) * 1; angle = (Math.PI * 2) // which is 1 rotation When we do this, everything is timsed by 1, so nothing is changed. We'd get the same result if we weren't using delta time at all! My questions are as follows Mostly importantly, have I got the right end of the stick here? How do we know to set the duration to 5000 ? Or can it be any number? I'm a bit vague about the "computer going too quickly". Is there a way loop less often rather than reduce the animation steps? Seems like a better idea. Using this method, do all of our animations need to be timesed by the scalar? Do we have to hunt down every last one and times it? Is this the best way to implement delta time? I think not, due to the fact the computer can go nuts and all we do is divide each animation step and because we need to hunt down every step and times it by the scalar. Not a very nice DSL, as it were. So what is the best way to implement delta time? Below is one way that I do not really get but may be a better way to implement delta time. Could someone explain please? // Globals INV_MAX_FPS = 1 / 60; frameDelta = 0; clock = new THREE.Clock(); // In the animation loop (the requestAnimationFrame callback)… frameDelta += clock.getDelta(); // API: "Get the seconds passed since the last call to this method." while (frameDelta >= INV_MAX_FPS) { update(INV_MAX_FPS); // calculate physics frameDelta -= INV_MAX_FPS; } How I think this works: Firstly we set INV_MAX_FPS to 0.01666666666 How we will use this number number does not jump out at me. We then intialize a frameDelta which stores how long the last loop took to run. Come the first loop frameDelta is not greater than INV_MAX_FPS so the loop is not run (0 = 0.01666666666). So nothing happens. Now I really don't know what would cause this to happen, but let's pretend that the loop we just went through took 2 seconds to complete: We set frameDelta to 2: frameDelta += clock.getDelta(); frameDelta += 2.00 Now we run an animation thanks to update(0.01666666666). Again what is relevance of 0.01666666666?? And then we take away 0.01666666666 from the frameDelta: frameDelta -= INV_MAX_FPS; frameDelta = frameDelta - INV_MAX_FPS; frameDelta = 2 - 0.01666666666 frameDelta = 1.98333333334 So let's go into the second loop. Let's say it took 2(? Why not 2? Or 12? I am a bit confused): frameDelta += clock.getDelta(); frameDelta = frameDelta + clock.getDelta(); frameDelta = 1.98333333334 + 2 frameDelta = 3.98333333334 This time we enter the while loop because 3.98333333334 = 0.01666666666 We run update We take away 0.01666666666 from frameDelta again: frameDelta -= INV_MAX_FPS; frameDelta = frameDelta - INV_MAX_FPS; frameDelta = 3.98333333334 - 0.01666666666 frameDelta = 3.96666666668 Now let's pretend the loop is super quick and runs in just 0.1 seconds and continues to do this. (Because the computer isn't busy any more). Basically, the update function will be run, and every loop we take away 0.01666666666 from the frameDelta untill the frameDelta is less than 0.01666666666. And then nothing happens until the computer runs slowly again? Could someone shed some light please? Does the update() update the scalar or something like that and we still have to times everything by the scalar like in the first example?

    Read the article

  • iPhone - UIView Animation not looping correctly

    - by Robert
    Hey all, got a little problem here and can't figure out what I am doing wrong. I am trying to animate a UIView up and down repeatedly. When I start it, it goes down correctly and then back up but then immediately shoots to the "final" position of the animation. Code is as follows: UIImageView *guide = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"]]; guide.frame = CGRectMake(250, 80, 30, 30); [self.view addSubview:guide]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:2]; [UIView setAnimationRepeatAutoreverses:YES]; [UIView setAnimationBeginsFromCurrentState:YES]; guide.frame = CGRectMake(250, 300, 30, 30); [UIView setAnimationRepeatCount:10]; [UIView commitAnimations]; Thanks in advance!

    Read the article

  • Fade animation UITableViewCell

    - by Tomas
    Hi everyone, I have a UITableViewController that populates a UITableView with some data that I pull off the net. The data for each cell consists also of an image used as background, which I'm downloading in a separated NSOperation added to a NSOperationQueue with a MaxConcurrentOperationCount set to 4. As long as the image is not downloaded I'm showing a generic placeholder which I would like to replace (fading out/fading in) with the downloaded image once it's being successfully downloaded. I'm using the following code placed inside the cellForRowAtIndexPath of the UITableViewController. [UIView beginAnimations:@"fade" context:nil]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationDuration:3.0]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; cell.placeholderUIImage.alpha = 0.0; cell.backgroundUIImage.alpha = 1.0; [UIView commitAnimations]; This is unfortunately just working randomly for a couple of rows, since for the most the background image is set instantly, as if the animation started on one cell would have been "overwritten" by the next call of beginAnimations.

    Read the article

  • C# animation - move object from A to B or by angle

    - by Nullstr1ng
    Hi am just doing a little animation which moves an object from point a to point b or by angle/radians. what I currently have is this Point CalcMove(Point pt, double angle, int speed) { Point ret = pt; ret.X = (int)(ret.X + speed * Math.Sin(DegToRad(angle))); ret.Y = (int)(ret.Y + speed * Math.Cos(DegToRad(angle))); return ret; } but it doesn't look what i expected. please help? update: oh and am using NETCF

    Read the article

  • Efficient skeletal animation

    - by Will
    I am looking at adopting a skeletal animation format (as prompted here) for an RTS game. The individual representation of each model on-screen will be small but there will be lots of them! In skeletal animation e.g. MD5 files, each individual vertex can be attached to an arbitrary number of joints. How can you efficiently support this whilst doing the interpolation in GLSL? Or do engines do their animation on the CPU? Or do engines set arbitrary limits on maximum joints per vertex and invoke nop multiplies for those joints that don't use the maximum number? Are there games that use skeletal animation in an RTS-like setting thus proving that on integrated graphics cards I have nothing to worry about in going the bones route?

    Read the article

  • Image animation problem in silverlight

    - by Jak
    Hi followed " http://www.switchonthecode.com/tutorials/silverlight-3-tutorial-planeprojection-and-perspective-3d#comment-4688 ".. the animation is working fine. I am new to silver light. when i use dynamic image from xml instead of static image as in tutorial,.. it is not working fine, please help me on this. i used list box.. for this animation effect do i need to change listbox to some other arrangement ? if your answer yes means, pls give me some sample code. Thanks in advance. Xaml code: <ListBox Name="listBox1"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <Image Source="{Binding imgurl}" HorizontalAlignment="Left" Name="image1" Stretch="Fill" VerticalAlignment="Top" MouseLeftButtonUp="FlipImage" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> My C# code: //getting image URL from xml XElement xmlads = XElement.Parse(e.Result); //i bind the url in to listBox listBox1.ItemsSource = from ads in xmlads.Descendants("ad") select new zestItem { imgurl = ads.Element("picture").Value }; public class zestItem { public string imgurl { get; set; } } private int _zIndex = 10; private void FlipImage(object sender, MouseButtonEventArgs e) { Image image = sender as Image; // Make sure the image is on top of all other images. image.SetValue(Canvas.ZIndexProperty, _zIndex++); // Create the storyboard. Storyboard flip = new Storyboard(); // Create animation and set the duration to 1 second. DoubleAnimation animation = new DoubleAnimation() { Duration = new TimeSpan(0, 0, 1) }; // Add the animation to the storyboard. flip.Children.Add(animation); // Create a projection for the image if it doesn't have one. if (image.Projection == null) { // Set the center of rotation to -0.01, which will put a little space // between the images when they're flipped. image.Projection = new PlaneProjection() { CenterOfRotationX = -0.01 }; } PlaneProjection projection = image.Projection as PlaneProjection; // Set the from and to properties based on the current flip direction of // the image. if (projection.RotationY == 0) { animation.To = 180; } else { animation.From = 180; animation.To = 0; } // Tell the animation to animation the image's PlaneProjection object. Storyboard.SetTarget(animation, projection); // Tell the animation to animation the RotationYProperty. Storyboard.SetTargetProperty(animation, new PropertyPath(PlaneProjection.RotationYProperty)); flip.Begin(); }

    Read the article

  • Changing BeginTime stops animation

    - by SaphuA
    Hi, I have a storyboard as a resource in a rectangle with a simple doubleAnimation. <Storyboard x:Name="EffectStoryboard"> <DoubleAnimation From="0" To="500" Storyboard.TargetName="WaveEffect" Storyboard.TargetProperty="Val0" RepeatBehavior="Forever" Duration="01:00:00" /> </Storyboard> I start the storyboard in the loaded event of the rectangle: private void Rectangle_Loaded(object sender, RoutedEventArgs e) { Rectangle rectangle = sender as Rectangle; if (rectangle != null) { Storyboard storyboard = rectangle.Resources["EffectStoryboard"] as Storyboard; //DoubleAnimation doubleAnimation = storyboard.Children[0] as DoubleAnimation; //if (doubleAnimation != null) //{ // doubleAnimation.BeginTime = new TimeSpan(0, random.Next(0, 60), random.Next(0, 60)); //} storyboard.Begin(); } } The problem is that when I uncomment the commented code, the animation won't start anymore. Even when I use non-random values in the timespan. Why?

    Read the article

  • How to create an iPad directory view like animation?

    - by mahes25
    In the recent iOS 4.2 update, Apple introduced a nice animation for creating one level directories. I am trying to figure out how to implement a similar animation in my project. I would deeply appreciate it if anyone could give me any pointers to do this efficiently. From my investigation, I believe this animation or effect could be done very efficiently using Core Image which would allow me to write a custom filter. Unfortunately, Core Image is not available in iPhone. So how can do it? I read a blog post that explained a core animation scheme to create an iPad flip clock. The problem I have is similar but has important differences. Besides, I not excited about saving the subimage combinations, which I believe can cause a memory issue. Please enlighten me on the possible ways of doing this animation. I am relatively new to iOS programming, so I might have missed obvious ways of doing this animation or effect.

    Read the article

  • [Jquery] Help with animation

    - by Pennywise83
    Hì there, I've used the "FeatureList" Jquery Plugin to make my own content slider. The script can be found here: http://pastebin.com/7iyE5ADu Here is an exemplificative image to show what I'm triyng to achieve: http://i41.tinypic.com/6jkeq1.jpg Actually the slider add a "current" class to an item (in the example the squares 1,2 and 3) and for each thumb show a content in the main area. In the example, with an interval of 2 seconds, the script switch from 1 to 2, from 2 to 3, and so on. I'd like to make a continuous animation of the thumbs, anyone can help me?

    Read the article

  • sprite animation in openGL

    - by Sid
    I am facing problems on implementing sprite animation in opneGL ES. i've googled it and the only thing i am getting is the Tutorial implementing via Canvas. i know the way but i am having problems in implementing it. What i need : A sprite animation on collision detection. What i did : Collision Detection function working properly. PS : everything is working fine but i want to implement the animation in OPENGL ONLY. Canvas won't work in my case.

    Read the article

  • Display the y value of a uiImageView during an animation

    - by user1422132
    I have the following code: NSString *yValue; yValue=[[NSString alloc] initWithFormat:@"%1.2f" , imageView.center.y]; CGRect labelFrame = CGRectMake( 10, 100, 200, 50 ); UILabel* label5 = [[UILabel alloc] initWithFrame: labelFrame]; [label5 setBackgroundColor:[UIColor blackColor]]; [label5 setText: yValue]; [label5 setTextColor: [UIColor orangeColor]]; [self.view addSubview: label5]; This correctly shows the y value of the UIimageView but the problem is that it only shows the ending y value. When a person flicks the UIImageView I animate it using: [UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ recognizer.view.center = finalPoint; } What I want is the label5 to display the y value of the imageView during the animation not just after. Is it possible to do this?

    Read the article

  • Animation with CGPoint in for loop

    - by user1066524
    I'm trying to do an animation where when a person clicks from point A to Point B on screen the object should slowly slide straight across (horizontally) from point A to Point B. I tried doing a for loop with something like: for (CGFloat i=previousPoint.x; i <= newPoint.x; i++){ [UIView animateWithDuration:10 delay:0 options:nil animations:^ { [magnifier removeFromSuperview]; magnifier = [[MagnifierView alloc] init]; CGPoint np = {i, newPoint.y}; magnifier.viewToMagnify = imageView; magnifier.touchPoint = np; [imageView addSubview:magnifier]; [magnifier setNeedsDisplay]; } completion:^(BOOL finished) { }]; } but for some reason it is moving it way up and then eventually to point B. sort of in a weird curve. how can I do this correctly?

    Read the article

  • jQuery changing images with animation and waiting for it to trigger hyperlink

    - by user1476298
    I want to switch images on .click() using the url attr I can do so, but I can't figure out how to make it wait, until the animation is done to redirect to the new webpage. Here's the js $(function() { $('.cv').click(function(){ $("#cv img").fadeOut(2000, function() { $(this).load(function() { $(this).fadeIn(); }); $(this).attr("src", "images/cv2.png"); return true; }); }); }); Here's the html: <div id="cv" class="img one-third column"> <a class="cv" target="#" href="cv.joanlascano.com.ar"> <img src="images/cv1.png" alt="Curriculum"/> <br />CV</a> </div> Thank you in advantage!

    Read the article

  • WPF animation: binding to the "To" attribute of storyboard animation.

    - by bozalina
    Hi, I'm trying to create a button that behaves similarly to the "slide" button on the iPhone. I have an animation that adjusts the position and width of the button, but I want these values to be based on the text used in the control. Currently, they're hardcoded. Here's my working XAML, so far: <CheckBox x:Class="Smt.Controls.SlideCheckBox" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Smt.Controls" xmlns:System.Windows="clr-namespace:System.Windows;assembly=PresentationCore" Name="SliderCheckBox" mc:Ignorable="d"> <CheckBox.Resources> <System.Windows:Duration x:Key="AnimationTime">0:0:0.2</System.Windows:Duration> <Storyboard x:Key="OnChecking"> <DoubleAnimation Storyboard.TargetName="CheckButton" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" Duration="{StaticResource AnimationTime}" To="40" /> <DoubleAnimation Storyboard.TargetName="CheckButton" Storyboard.TargetProperty="(Button.Width)" Duration="{StaticResource AnimationTime}" To="41" /> </Storyboard> <Storyboard x:Key="OnUnchecking"> <DoubleAnimation Storyboard.TargetName="CheckButton" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" Duration="{StaticResource AnimationTime}" To="0" /> <DoubleAnimation Storyboard.TargetName="CheckButton" Storyboard.TargetProperty="(Button.Width)" Duration="{StaticResource AnimationTime}" To="40" /> </Storyboard> <Style x:Key="SlideCheckBoxStyle" TargetType="{x:Type local:SlideCheckBox}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:SlideCheckBox}"> <Canvas> <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" RecognizesAccessKey="True" VerticalAlignment="Center" HorizontalAlignment="Center" /> <Canvas> <!--Background--> <Rectangle Width="{Binding ElementName=ButtonText, Path=ActualWidth}" Height="{Binding ElementName=ButtonText, Path=ActualHeight}" Fill="LightBlue" /> </Canvas> <Canvas> <!--Button--> <Button Width="{Binding ElementName=CheckedText, Path=ActualWidth}" Height="{Binding ElementName=ButtonText, Path=ActualHeight}" Name="CheckButton" Command="{x:Static local:SlideCheckBox.SlideCheckBoxClicked}"> <Button.RenderTransform> <TransformGroup> <TranslateTransform /> </TransformGroup> </Button.RenderTransform> </Button> </Canvas> <Canvas> <!--Text--> <StackPanel Name="ButtonText" Orientation="Horizontal" IsHitTestVisible="False"> <Grid Name="CheckedText"> <Label Margin="7 0" Content="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:SlideCheckBox}}, Path=CheckedText}" /> </Grid> <Grid Name="UncheckedText" HorizontalAlignment="Right"> <Label Margin="7 0" Content="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:SlideCheckBox}}, Path=UncheckedText}" /> </Grid> </StackPanel> </Canvas> </Canvas> <ControlTemplate.Triggers> <Trigger Property="IsChecked" Value="True"> <Trigger.EnterActions> <BeginStoryboard Storyboard="{StaticResource OnChecking}" /> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard Storyboard="{StaticResource OnUnchecking}" /> </Trigger.ExitActions> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </CheckBox.Resources> <CheckBox.CommandBindings> <CommandBinding Command="{x:Static local:SlideCheckBox.SlideCheckBoxClicked}" Executed="OnSlideCheckBoxClicked" /> </CheckBox.CommandBindings> </CheckBox> And the code behind: using System.Windows; using System.Windows.Controls; using System.Windows.Input; namespace Smt.Controls { public partial class SlideCheckBox : CheckBox { public SlideCheckBox() { InitializeComponent(); Loaded += OnLoaded; } public static readonly DependencyProperty CheckedTextProperty = DependencyProperty.Register("CheckedText", typeof(string), typeof(SlideCheckBox), new PropertyMetadata("Checked Text")); public string CheckedText { get { return (string)GetValue(CheckedTextProperty); } set { SetValue(CheckedTextProperty, value); } } public static readonly DependencyProperty UncheckedTextProperty = DependencyProperty.Register("UncheckedText", typeof(string), typeof(SlideCheckBox), new PropertyMetadata("Unchecked Text")); public string UncheckedText { get { return (string)GetValue(UncheckedTextProperty); } set { SetValue(UncheckedTextProperty, value); } } public static readonly RoutedCommand SlideCheckBoxClicked = new RoutedCommand(); void OnLoaded(object sender, RoutedEventArgs e) { Style style = TryFindResource("SlideCheckBoxStyle") as Style; if (!ReferenceEquals(style, null)) { Style = style; } } void OnSlideCheckBoxClicked(object sender, ExecutedRoutedEventArgs e) { IsChecked = !IsChecked; } } } The problem comes when I try to bind the "To" attribute in the DoubleAnimations to the actual width of the text, the same as I'm doing in the ControlTemplate. If I bind the values to an ActualWidth of an element in the ControlTemplate, the control comes up as a blank checkbox (my base class). However, I'm binding to the same ActualWidths in the ControlTemplate itself without any problems. Just seems to be the CheckBox.Resources that have a problem with it. For instance, the following will break it: <DoubleAnimation Storyboard.TargetName="CheckButton" Storyboard.TargetProperty="(Button.Width)" Duration="{StaticResource AnimationTime}" To="{Binding ElementName=CheckedText, Path=ActualWidth}" /> I don't know whether this is because it's trying to bind to a value that doesn't exist until a render pass is done, or if it's something else. Anyone have any experience with this sort of animation binding?

    Read the article

  • GridView row remove and animation - Android

    - by Pria
    I have a GridView in which each row has a custom view. The grid view adapter has an array that keeps the custom view. At click of a button, I want to remove a specific row from the Grid and while doing so I want animation on it. I have an AnimationListener. When I remove the upper most row from the array and setAdapter in onAnimationEnd(). It works perfectly fine. But, when I remove any other row, it gives a NullPointerException in the main thread. The exception thread is as follows: ERROR/AndroidRuntime(11503): java.lang.NullPointerException at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1227) at android.widget.AbsListView.dispatchDraw(AbsListView.java:1319) at android.view.View.draw(View.java:5944) at android.widget.AbsListView.draw(AbsListView.java:2121) at android.view.ViewGroup.drawChild(ViewGroup.java:1486) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) at android.view.View.draw(View.java:5841) at android.widget.FrameLayout.draw(FrameLayout.java:352) at android.view.ViewGroup.drawChild(ViewGroup.java:1486) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) at android.view.View.draw(View.java:5841) at android.widget.FrameLayout.draw(FrameLayout.java:352) at android.view.ViewGroup.drawChild(ViewGroup.java:1486) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228) at android.view.View.draw(View.java:5841) at android.widget.FrameLayout.draw(FrameLayout.java:352) at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1847) at android.view.ViewRoot.draw(ViewRoot.java:1217) at android.view.ViewRoot.performTraversals(ViewRoot.java:1030) at android.view.ViewRoot.handleMessage(ViewRoot.java:1482) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:3948) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) at dalvik.system.NativeStart.main(Native Method) Please help!!!

    Read the article

  • Blind down animation on CALayer using a mask

    - by dgjones346
    Hi there, I want to create a "blind down" effect on an image so the image "blinds down" and appears. Sort of like this JavaScript transition: http://wiki.github.com/madrobby/scriptaculous/effect-blinddown The mask is setup correctly because if I manually change it's position it hides and reveals the image behind it, but it doesn't animate! It just ends up in the animates final position and you never see it actual blind. Please help! Maybe this isn't the best way to achieve a blind down effect? // create a new layer CALayer *numberLayer = [[CALayer alloc] init]; // render the number "7" on the layer UIImage *image = [UIImage imageNamed:@"number-7.png"]; numberLayer.contents = (id) [image CGImage]; numberLayer.bounds = CGRectMake(0, 0, image.size.width, image.size.height); // width and height are 50 numberLayer.position = position; // create a new mask that is 50x50 the size of the image CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; CGMutablePathRef path = CGPathCreateMutable(); CGPathAddRect(path, nil, CGRectMake(0, 0, 50, 50)); [maskLayer setPath:path]; [maskLayer setFillColor:[[UIColor whiteColor] CGColor]]; [theLayer setMask:maskLayer]; [maskLayer setPosition:CGPointMake(0, 0)]; // place the mask over the image [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:3.0]; [maskLayer setPosition:CGPointMake(0, 50)]; // slide mask off the image // this should shift the blind away in an animation // but it doesn't animate [UIView commitAnimations]; [maskLayer release]; [boardLayer addSublayer:numberLayer]; [numberLayer release];

    Read the article

  • Help with stock ticker style scrolling using Core Animation

    - by Glen Harding
    Hi, I'm looking for some guidance on the best way to implement stock ticker style right-to-left scrolling of CALayers in Core Animation on OSX. I'm pretty new to Cocoa and don't know the best way to implement this. I have a continuous stream of news items and stock details that I turn into CALayers (made up of 1 image and a CATextLayer) and I want to animate the CALayers from right to left of my custom view. The news and stock information is constantly updating so I would like to add 1 item at a time to the view, scroll it right to left until the right-most point of the CALayer is showing, then add another CALayer to the view and start scrolling that as well. I would like to do this dynamic updating instead of taking a big snapshot of all my data, turning it into a big horizontal CALayer and scrolling that. I'm looking for guidance on how to achieve this sort of effect - do I manually animate each new CALayer along a path in the view? Or should I be using CAScrollLayer to achieve this effect? Many thanks Glen.

    Read the article

  • iPad: Move UIView with animation, then move it back

    - by Joel
    I have the following code in a UIView subclass that will move it off the screen with an animation: float currentX = xposition; //variables that store where the UIView is located float currentY = yposition; float targetX = -5.0f - self.width; float targetY = -5.0f - self.height; moveX = targetX - currentX; //stored as an instance variable so I can hang on to it and move it back moveY = targetY - currentY; [UIView beginAnimations:@"UIBase Hide" context:nil]; [UIView setAnimationDuration:duration]; self.transform = CGAffineTransformMakeTranslation(moveX,moveY); [UIView commitAnimations]; It works just great. I've changed targetX/Y to 0 to see if it does indeed move to the specified point, and it does. The problem is when I try and move the view back to where it was originally: moveX = -moveX; moveY = -moveY; [UIView beginAnimations:@"UIBase Show" context:nil]; [UIView setAnimationDuration:duration]; self.transform = CGAffineTransformMakeTranslation(moveX,moveY); [UIView commitAnimations]; This puts the UIView about 3x as far as it should. So the view usually gets put off the right side of the screen (depending on where it is). Is there something with the CGAffineTransforMakeTranslation function that I should know? I read the documentation, and from what I can tell, it should be doing what I'm expecting it to do. Anyone have a suggestion of how to fix this? Thanks.

    Read the article

  • UIView Animation animates position but not width

    - by Aaron Vegh
    Hi there, I'm trying to transform a UISearchBar, like in Mobile Safari: touch in the search field and it grows while the location field shrinks. My current animation to alter the width and position of the search field only animates the position: just before it slides to the right place, it simply snaps out to the right width. Here's my code: [UIView beginAnimations:@"searchGrowUp" context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseIn]; [UIView setAnimationDuration:0.5f]; [UIView setAnimationDelegate:self]; CGFloat findFieldWidth = findField.frame.size.width; CGFloat urlFieldWidth = urlField.frame.size.width; CGRect findFieldFrame = findField.frame; CGRect urlFieldFrame = urlField.frame; findFieldFrame.origin.x = findFieldFrame.origin.x - 150.0f; findFieldFrame.size.width = findFieldWidth + 150.0f; urlFieldFrame.size.width = urlFieldWidth - 150.0f; urlField.frame = urlFieldFrame; findField.frame = findFieldFrame; [UIView commitAnimations]; I've modified this code slightly for the sake of presenting it here, but I hope this gives the gist. Any guesses as to why this is happening would be appreciated! Cheers, Aaron.

    Read the article

  • Raphael JS image animation performance.

    - by michael
    Hi, I'm trying to create an image animation using Raphael JS. I want the effect of a bee moving randomly across the page, I've got a working example but it's a bit "jittery", and I'm getting this warning in the console: "Resource interpreted as image but transferred with MIME type text/html" I'm not sure if the warning is causing the "jittery" movement or its just the way I approached it using maths. If anyone has a better way to create the effect, or improvements please let me know. I have a demo online here and heres my javascript code: function random(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function BEE(x, y, scale) { this.x = x; this.y = y; this.s = scale; this.paper = Raphael("head", 915, 250); this.draw = function() { this.paper.clear(); this.paper.image("bee.png", this.x, this.y, 159*this.s, 217*this.s); } this.update = function() { var deg = random(-25, 25); var newX = Math.cos(Raphael.rad(deg)) * 2; var newY = Math.sin(Raphael.rad(deg)) * 2; this.x += newX; this.y += newY; if( this.x > 915) { this.x = 0; } if( this.y > 250 || this.y < 0 ) { this.y = 125; } } } $(document).ready(function() { var bee = new BEE(100, 150, 0.4); var timer = setInterval(function(){ bee.draw(); bee.update(); }, 15); }

    Read the article

  • UIView animation only animating some of the things I ask it to

    - by Ben
    I have a series of (say) boxes on the screen in a row, all subviews of my main view. Each is a UIView. I want to shift them all left and have a new view also enter the screen from the right in lockstep. Here's what I'm doing: // First add a dummy view offscreen UIView * stagingView = /* make this view, which sets up its width/height */ CGRect frame = [stagingView frame]; frame.origin.x = /* just off the right side of the screen */; [stagingView setFrame:frame]; [self stagingView]; And then I set up animations in one block for all of my subviews (which includes the one I just added): [UIView beginAnimations:@"shiftLeft" context:NULL]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(_animationDidStop:context:)]; [UIView setAnimationDuration:0.3]; for (UIView * view in [self subviews]) { CGRect frame = [view frame]; frame.origin.x -= (frame.size.width + viewPadding); [view setFrame:frame]; } [UIView commitAnimations]; Here's what I expect: The (three) views already on screen get shifted left and the newly staged view marches in from the right at the same time. Here's what happens: The newly staged view animates in exactly as expected, and the views already on the screen do not appear to move at all! (Or possibly they jump without animation to their end locations). And! If I comment out the whole business of creating the new subview offscreen... the ones onscreen do animate correctly! Huh? (Thanks!)

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >