Bug 24214 - CALayer.BeginTime does not appear to be working
Summary: CALayer.BeginTime does not appear to be working
Status: RESOLVED INVALID
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.2.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-11-02 18:26 UTC by Cody Beyer (MSFT)
Modified: 2014-11-03 03:56 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
TestCase (14.93 KB, application/zip)
2014-11-02 18:26 UTC, Cody Beyer (MSFT)
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Cody Beyer (MSFT) 2014-11-02 18:26:01 UTC
Created attachment 8589 [details]
TestCase

#### Description 

CALayer.Begin time us supposed to specify at which time, relative to the absolute time for CoreAnimation, an animation is supposed to begin. However, this does not appear to function correctly. When this is set, the animation does not happen correctly.

[1] shows (almost) how it is supposed to behave

[2] shows the behavior in CALayer.BeginTime is used. 

It appears that the BeginTime is respected, but all other settings for the animation are ignored, such as the fade.

#### Test Case

The attached Sample Animation demonstrates the issue. 

Steps to reproduce:

1. Open Attached TestCase
2. Uncomment line 87 of SampleAnimationViewController.cs
3. Run app and notice behavior is such as [2]
4. Comment out line 87 of SampleAnimationViewController.cs
5. Run again and notice behavior is such as [1]

#### Version Information

=== Xamarin Studio ===

Version 5.6.2 (build 5)
Installation UUID: 3e4348fa-e0b3-46a4-8426-58f27e19159e
Runtime:
	Mono 3.10.0 ((detached/633e444)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000020

=== Apple Developer Tools ===

Xcode 6.1 (6604)
Build 6A1052d

=== Xamarin.Mac ===

Version: 1.10.0.18 (Business Edition)

=== Xamarin.Android ===

Version: 4.18.1 (Business Edition)
Android SDK: /Users/codybeyer/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.2   (API level 17)
		4.4   (API level 19)
Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

=== Xamarin.iOS ===

Version: 8.4.0.16 (Business Edition)
Hash: 80e9ff7
Branch: 
Build date: 2014-10-22 15:09:12-0400

=== Build Information ===

Release ID: 506020005
Git revision: 19bc3b64b70332bfab18faf9cf1ce7d3aa191b36
Build date: 2014-10-17 14:49:01-04

=== Operating System ===

Mac OS X 10.10.0
Darwin Codys-MacBook-Pro.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64


#### Links

[1] https://www.dropbox.com/s/h2ljulc6md714wq/RedFade.mov?dl=0 
[2] https://www.dropbox.com/s/gvxmhvqj700024c/CAFail.mov?dl=0
Comment 1 Rajneesh Kumar 2014-11-03 00:44:25 UTC
I have checked this issue  and able to reproduce this issue. To reproduce this issue I have followed the sample application and steps mentioned in bug description.

Steps I followed:

1. Open Attached Sample in XS
2. Uncomment line 87 of SampleAnimationViewController.cs file
3. Run app and observe the  behavior, all other settings for the animation are ignored, such as the fade.
4. Comment out line 87 of SampleAnimationViewController.cs
5. Run again and observe the  behavior, it shows (almost) how it is supposed to behave means all the setting for the animation are working.

Screencast: http://www.screencast.com/t/6XcpXsZ2o7m

Environment Info:

=== Xamarin Studio ===

Version 5.5.3 (build 6)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
	Mono 3.10.0 ((detached/e204655)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000023

=== Xamarin.Android ===

Version: 4.18.1 (Business Edition)
Android SDK: /Users/MM/Desktop/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		3.2    (API level 13)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		4.5    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Apple Developer Tools ===

Xcode 6.0.1 (6528)
Build 6A317

=== Xamarin.iOS ===

Version: 8.2.0.193 (Business Edition)
Hash: 959c1e4
Branch: 
Build date: 2014-10-03 00:25:37-0400

=== Xamarin.Mac ===

Version: 1.10.0.18 (Business Edition)

=== Build Information ===

Release ID: 505030006
Git revision: fbe3e9453daf6a3bb9a9709ed22bec35f7c9056b
Build date: 2014-10-23 13:08:38-04
Xamarin addins: e44add2b39de4dd57c0742bb2e620dfad84c64c6

=== Operating System ===

Mac OS X 10.9.5
Darwin MacMini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 2 Rolf Bjarne Kvinge [MSFT] 2014-11-03 03:56:01 UTC
Apparently BeginTime only work for CAAnimations that are part of CAAnimationGroups [1] [2].

This works:

	public void StartRevealAnimation ()
	{
		CATransaction.Begin ();
		var beginTime = CAAnimation.CurrentMediaTime () + 1;
		for (int x = 0; x < 6; x++) {
			for (int y = 0; y < 6; y++) {
				var anim = CABasicAnimation.FromKeyPath ("opacity");
				anim.From = new NSNumber (1.0f);
				anim.To = new NSNumber (0.0f);
				anim.FillMode = CAFillMode.Forwards;
				anim.BeginTime = beginTime + x + y;
				anim.Duration = 1 + x + y * 1.5f;
				anim.RemovedOnCompletion = false;

				_maskLayers [x, y].AddAnimation (anim, null);
			}
		}
		CATransaction.Commit ();
	}

[1] http://stackoverflow.com/a/9123634/183422
[2] http://stackoverflow.com/a/563486/183422