- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在Cocos2d(Android,JAVA)中,我使用CCRotateBy来旋转一个CCNode,其中包含多个子节点。我想使用中心图 block 的中心作为旋转点,所以我想我应该使用 anchor 。
但是,无论我为 anchor 赋予什么值,图 block 都会围绕屏幕左下角旋转。怎么会?
(图 block 是 CCNode,收集在两个列表中,tilesSelected 和 secondaryTilesSelected)
// I create one node which holds all the tiles I want to rotate
CCNode tilesToRotate = CCNode.node();
tilesToRotate.addChild(tilesSelected.get(0), 0, 99);
// then, I add the 4 tiles around the previous, center tile
for (int i=0; i < secondaryTilesSelected.size(); i++){
tilesToRotate.addChild(secondaryTilesSelected.get(i), 0, 99);
}
// So, if I change 700,700 hereunder to different values, it doesn't change the centerpoint for Rotation. I guess I don't get it...
addChild(tilesToRotate);
tilesToRotate.setAnchorPoint(CGPoint.make(700,700));
CCAction r90 = CCRotateBy.action(1f, 90f);
tilesToRotate.runAction(r90);
最佳答案
anchorPoint 是 0,0(左下角)到 1,1(内容右上角)范围内的因子
您将 anchor 设置为距节点 700,700 太远
关于java - RotateBy Anchorpoint 不影响旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28519484/
在Cocos2d(Android,JAVA)中,我使用CCRotateBy来旋转一个CCNode,其中包含多个子节点。我想使用中心图 block 的中心作为旋转点,所以我想我应该使用 anchor 。
我已成功为图层的位置和变换(旋转)制作动画。 现在,我需要为 anchor 设置动画,但所有尝试都失败了!即使我这样做: 2012... App[6437:403] layer: 1, KeyPath
所以我使用此代码顺时针或逆时针旋转对象。 override func touchesEnded(touches: Set, withEvent event: UIEvent?) { l
当我更改 GameScene 的 anchorPoint (从默认 0,0 到 0.5,0.5) 时, Sprite 的 physicsBody 从屏幕上消失了 使用 kView 进行调试.shows
我有一个继承自 SKNode 的自定义类,我想在该类上实现 SKSpriteNode 的类似 anchor 的功能。具体来说,我想要实现的是自动将自定义节点置于父节点的中心(anchorPoint 为
我正在尝试设计一款 Swift 游戏,但我注意到我无法让游戏中的球进入屏幕的左上角。我在下面设置了 anchor 。 override func didMoveToView(view: SKView)
我一直在使用 CGAffineTransformMakeScale 来缩放 UIView。这将通过默认的 anchor 对其进行缩放,即 (.5, .5) -- 中心。我想缩放它,使其向左拉伸(str
我使用的代码来自 apple 的 Touches code (我刚刚将 piece 的变量名更改为 image): - (void)adjustAnchorPointForGestureRecogni
我想使用 Sprite Kit 制作一个基于文本的游戏(就像那些学习打字游戏一样)。 我以为我会为字符串使用 SKLabelNode,但是当我尝试设置 anchorPoint 以旋转它时,我得到一个错
我的游戏基于并排的两个屏幕(A 和 B),但设备屏幕一次只能显示其中一个。 例如 A 在位置 (0, 0),B 在 (320, 0) 我尝试了两种从 A 切换到 B 的解决方案: 首先,我将整个场景放
我将 UICollectionViewFlowLayout 子类化以在水平滚动期间实现小的缩放效果。因此,我不得不继承 UICollectionViewCell 并更改单元格的 layer.ancho
我正在制作一个带有可旋转饼图的应用。但是,我的饼图围绕 (0,0) 旋转,我找不到使其围绕其中心旋转的解决方案。 部分代码: // DRAWING CODE // Set constants
我下载了这个示例:https://developer.apple.com/library/ios/#samplecode/Touches/Introduction/Intro.html#//apple
Google Maps API v3 文档说 MarkerOptions 可以包含 anchorPoint 来指定偏移量(相对于标记移动图标): https://developers.google.c
注意:这是针对 OS X 而非 iOS 上的 Cocoa 应用。 我有一个层支持的 NSButton(NSView 的子类)。我想要做的是使用 Core Animation 旋转那个按钮。我正在使用以
我不知道是不是只有我一个人这样,但我刚刚注意到默认的 AnchorPoint 已更改为 0, 0。如何将其更改回 0.5, 0.5?或者如果无法更改默认 AnchorPoint,那么请告诉我如何更改
我正在尝试使用 UIGestureRecognizers 旋转、平移和缩放 UIView。识别器被添加到父 View ,而旋转、缩放等被应用到 subview (_baseImage),这是为了让我能
[self setTransform:CGAffineTransformIdentity]; [self setFrame:CGRectMake(o.x, o.y, width, self.frame
我是一名优秀的程序员,十分优秀!