core-animation

Force clockwise/anticlockwise rotation for a CABasicAnimation of a UIImageView

你说的曾经没有我的故事 提交于 2019-12-04 19:54:27
问题 I'm animating a pendulum which swings from 0 degrees to max 200 degrees and then back again. The problem is that if the pendulum goes over 180 degrees, it returns to 0 by the shortest route which is to continue clockwise. And I'd like it to go anticlockwise. Here's my code: ('right' is a boolean which is TRUE when the pendulum is swinging from left to right) - (void)swingPendulum { CABasicAnimation *rotationAnimation; rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform

How can I make a 3-D cube from 6 images in my iPhone application?

旧巷老猫 提交于 2019-12-04 19:43:34
I'm new to iPhone programming. I have 6 PNGs that represent all sides of my classroom from the inside. I would like to make them into a single 3-D cube that you would view from the inside, with the ability to look around this cube by moving your finger. How would I go about implementing something like this? I found Core Animation's CATransform3D and a little about textures in OpenGL, but I'm not sure what to use for my case. You're looking for something called a Skybox . The coding for this is well understood and you shouldn't have any difficulty finding example OpenGL code to use. Here is as

How to detect hardware acceleration for Core Image?

南楼画角 提交于 2019-12-04 19:15:29
In my app I'm using a "CIMotionBlur" CIFilter during CALayer animation. The problem is that the filter does not work properly when hardware acceleration is not available: In OS X Safe Mode the layer becomes invisible during animation; When using VMWare Fusion the animation is unbearably slow and makes testing the app harder; Animation works fine without the filter. I'd like to apply filter only when hardware acceleration is available. What's the highest level API that would let me know when to disable the filter? I'm going to look for clues in IOKit. I found the answer in Technical Q&A QA1218

NSImage rotation in NSView is not working

对着背影说爱祢 提交于 2019-12-04 18:48:43
I am trying to rotate an NSImage inside a NSView., First I will show you what I have done so far. Image : Header file #import <Foundation/Foundation.h> #import <QuartzCore/QuartzCore.h> @interface AppController : NSObject { CALayer *syncFirst; } @property (weak) IBOutlet NSView *nsview; - (IBAction)buttonClicked:(id)sender; - (CGImageRef) convertToCGImageFromNasImage:(NSImage *) image; @end Implementation file, only related methods - (void)awakeFromNib { NSImage *image = [NSImage imageNamed:@"SyncRing.png"]; //init layer syncFirst = [CALayer layer]; //animatated content size init syncFirst

How to animate drawing in Swift, but also change a UIImageView's scale?

那年仲夏 提交于 2019-12-04 18:27:26
I'd like to animate a drawing sequence. My code draws a spiral into a UIImageView.image. The sequence changes the image contents, but also changes the scale of the surrounding UIImageView. The code is parameterized for the number of revolutions of the spiral: func drawSpiral(rotations:Double) { let scale = scaleFactor(rotations) // do some math to figure the best scale UIGraphicsBeginImageContextWithOptions(mainImageView.bounds.size, false, 0.0) let context = UIGraphicsGetCurrentContext()! context.scaleBy(x: scale, y: scale) // some animation prohibits changes! // ... drawing happens here

Core Animation window flip effect

倖福魔咒の 提交于 2019-12-04 18:27:18
Any tutorials or sample code to get the Core Animation window flip effect? I'm using Flipr right now, which uses Core Image to generate the effect but CoreAnimation is much smoother Thanks Mike Lee released some code for just this a while back. He called it LemurFlip . take a look at uli kusterers windowflipper code. http://www.zathras.de/angelweb/sourcecode.htm (search for WindowFlipper) have no experience with it, but it just might work for you :) Arvin I added some code on how I do it using Core animation: Link 来源: https://stackoverflow.com/questions/1263191/core-animation-window-flip

How do I convert 3D OpenGL matrix transforms to CoreAnimation CATransform3Ds?

ぐ巨炮叔叔 提交于 2019-12-04 18:23:37
Picture an OpenGL ES 1.1 rendering surface with a transparent CALayer of the same frame and bounds directly above it. Objects in the OpenGL scene are transformed (translated and rotated) using a 4x4 matrix. The overlayed CALayer transforms sublayers with a CATransform3D ( which happens to be a 4x4 matrix, identical to ones used for OpenGL transforms ). The OpenGL matrices transform the scene objects in exactly the manner I would like them to. I would then like to take the same matrix transform used on the scene object and have the CALayer apply it to a sublayer such that the sublayer is in the

iOS: How to animate a flip between two UIViews?

本小妞迷上赌 提交于 2019-12-04 18:15:06
I am trying to animate a flip effect between a UIButton instance and a UIImageView instance. Basically it's a "flip over a playing card" effect, one side (UIImageView) is just a nice pattern and when flipped, it should show a UIButton with some text. My code features the following problems: the text of the UIButton sub-view is not shown after flipping the shadow disappears during the flip animation Here's a visual representation of the goal: Here you can download the very simple sample app. Any suggestions how to solve the two mentioned issues ? I am really out of ideas - any help highly

UIViewController Containment with animation like Google+

假如想象 提交于 2019-12-04 17:48:16
The best way to understand what I'm trying to explain is to open Google+ app and tap anywhere in background of a post displayed in the main stream of posts. When you tap it, the entire post moves itself at the center of the screen with a nice animation and it loads the post's comments below it. I think this is a common UIViewController containment scenario, where one UIViewController is inside another. But how the post can moves it animately and "transfering" itself inside the contained view controller? I've already tried to create a simple button and display an UIViewController as a popup of

iOS 10 UILabels -> 1 UIView -> Loop through with Animation

人盡茶涼 提交于 2019-12-04 17:09:50
I have 10 UILabels , maybe some UIImageViews . I want to display all these in 1 UIView with smooth FadeOut & FadeIn transition, one after the other. I know putting UIView animations in a for-loop will not work as animations are done asynchronous & will not give proper effect. So the way normally I would do this is to chain UIView animation together. i.e. after one elements animation is complete begin the next one. For 3-4 elements the code looks ok. Like so - [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationCurveEaseInOut animations:^{ //do something with alpha here - first