rotation

Rotate text in a canvas with javascript

橙三吉。 提交于 2020-01-17 02:56:05
问题 In the following code i want to rotate the text of each element of the array in javascript. If i use for example ctx.rotate(Math.PI/10) before the filltext, it rotates all the elements. The positioning of the text also changes with ctx.rotate(Math.PI/10) and if i use 90 degrees, ctx.rotate(Math.PI/2) the text does not show on the canvas. <html> <canvas id="myCanvas" width="300" height="300" style="border:1px solid #d3d3d3;"></canvas> <script> var c = document.getElementById("myCanvas"); var

Activity restart on rotation Android

瘦欲@ 提交于 2020-01-16 19:31:34
问题 In my Android application, when I rotate the device (slide out the keyboard) then my Activity is restarted ( onCreate is called). Now, this is probably how it's supposed to be, but I do a lot of initial setting up in the onCreate method, so I need either: Put all the initial setting up in another function so it's not all lost on device rotation or Make it so onCreate is not called again and the layout just adjusts or Limit the app to just portrait so that onCreate is not called. 回答1: Using

three.js: Weird Rotation of child objects

喜欢而已 提交于 2020-01-16 18:42:32
问题 I'm trying to implement an experimental version of a 2x2x2 Rubiks Cube. I have adopted instructions from two previous posts with issues regarding child objects attachment and detachment: Three.js: Proper way to add and remove child objects using THREE.SceneUtils.attach/detach functions and Three.js: Adding and Removing Children of Rotated Objects and have been able to successfully understand how to rotate two faces independently. However, when I implement the same in code, I get weird results

viewWillLayoutSubviews and rotation

风格不统一 提交于 2020-01-16 18:38:28
问题 In my app I am positioning all of my views in viewWillLayoutSubviews. Recently I been asked to make the app handle all orientations. I figured that would be simple because I was using CGRect rotatedFrame = [self.view convertRect:self.view.frame fromView:nil]; Which would return a frame that matches the device current orientation. Unfortunately I found that this does not work for all situations. Namely if I present a modal viewcontroller, rotate it to landscape and then dismiss it, the parent

Rotation in flash causing image borders to look “pixely”, how to fix?

北城以北 提交于 2020-01-16 08:06:19
问题 I have a bitmap loaded in flash, for a 2D game. The bitmap represents a character and is rotating when the user uses the A (left) or D (right) keys. The problem I have is that the border of the image becomes ugly while rotating, you can see "pixels" (you can always see pixels, but I hope you understand what I mean). How can I fix this in actionscript 3, maybe change the rotation algorithm or "fix" the image after rotation? Or should I save/render the image differently in eg. Photoshop before

Applying a matrix in Three.js does not what I expect

只谈情不闲聊 提交于 2020-01-16 06:56:52
问题 For a project I am working on I am trying to get get a 3D-model of a building visible in a browser. Of all the elements of the building I have vertices, indices and a matrix3d. This information comes from an application that uses OpenGL to show the elements in a offline program. Now I am trying to add these elements to my Three.js scene. I am at the point that I can add elements to the scene defined by the vertices and indices an I can see them by using materials and lights, but I can not

SASS How make the page full height and width when rotated body?

随声附和 提交于 2020-01-16 06:46:13
问题 I'm have to rotate my body and make it full height and full width . Well, I used the vh metric and worked perfect for width , but height still not fitting well... I had to rotate 90 degrees but the height and width still referring the same orientation as not rotate. Ps: I added .red to be easier to see where the div/body is fitting. All I want is the rotated content fit the whole page/size of available the window EDIT I just found out that there is an way of doing it by computing sin and cos

How do I rotate an object around only one axis in RealityKit?

痴心易碎 提交于 2020-01-16 06:22:58
问题 I'm trying to rotate a cube around its z-axis but I can't find how. Is there a way in RealityKit to do this? 回答1: In RealityKit there are, at least, two ways to rotate object around single axis : First approach: let boxAnchor = try! Experience.loadBox() boxAnchor.steelBox?.orientation = simd_quatf(angle: .pi/4, /* 45 Deg in Rad */ axis: [0, 0, 1]) /* Around Z axis */ Second approach: boxAnchor.steelBox?.transform = Transform(pitch: 0, yaw: 0, roll: .pi/4) /* Around Z axis */ pitch is X axis

Moving gameobject in a smooth circle around the player object

早过忘川 提交于 2020-01-16 04:53:08
问题 I'm using unity 5.1.2 if that makes a difference. I have a game object shield, that I want to move in a circle around a player. I have it working to a degree, the shield responds well to input but is not animated in that it just teleports to the new position instead of moving around in a circle in a smooth rotation. The game is 2D top down so working in the x/y plane only. Have tried to use lerp and slerp but not getting any joy Would really appreciate your help to figure this one out! Here's

Rotated text producing inconsistent results

北城余情 提交于 2020-01-16 02:04:07
问题 I'm trying to display rotated text whereby its always absolute positioned to the bottom of its parent. The parent is 100% height of the browser window and I'd like the text to appear 50px from the bottom for all browser/screen sizes. Here's my code: html,body,.carousel,.carousel a.item { height: 100%; } .carousel a.item { height: 100%; padding-top: 100px; position: relative; overflow: hidden; width: 25%; float: left; } .rotate { zoom: 1; white-space: nowrap; position: absolute; bottom: 0;