惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tor Project blog
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 【当耐特】
G
Google Developers Blog
J
Java Code Geeks
The Cloudflare Blog
Attack and Defense Labs
Attack and Defense Labs
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in AI
Cisco Talos Blog
Cisco Talos Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
I
Intezer
Jina AI
Jina AI
T
Tenable Blog
P
Palo Alto Networks Blog
Project Zero
Project Zero
D
DataBreaches.Net
Hugging Face - Blog
Hugging Face - Blog
The Hacker News
The Hacker News
F
Full Disclosure
Cloudbric
Cloudbric
量子位
H
Heimdal Security Blog
K
Kaspersky official blog
有赞技术团队
有赞技术团队
罗磊的独立博客
V
Vulnerabilities – Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
阮一峰的网络日志
阮一峰的网络日志
Vercel News
Vercel News
Recent Announcements
Recent Announcements
WordPress大学
WordPress大学
GbyAI
GbyAI
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
Recorded Future
Recorded Future
Security Archives - TechRepublic
Security Archives - TechRepublic
AI
AI
Webroot Blog
Webroot Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
爱范儿
爱范儿
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Exploit Database - CXSecurity.com
Apple Machine Learning Research
Apple Machine Learning Research
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hacker News: Front Page
Latest news
Latest news

博客园 - kingBook

git patch git 修改最后一次提交的日期 Win10 修改特定格式文件的右键快捷菜单 TypeScript async、 await、Promise LayaAir3.x 侦听程序退出 旋转力学公式 凹多边形碰撞检测 LayaAir3.x 侦听键盘事件 URP 阴影 TypeScript 里的 override TypeScript 类的自身类型 Unity 二维数组序列化 C# 匿名对象、动态属性 Cocos Creator 安卓模拟器中无法运行 Unity Editor 保存图片、缩放纹理 LayaAir3.2.0-beta.2 设置2d刚体线性速度,在不同设备(分辨率)下,表现不一致的问题 LayaAir3.x 物理2D碰撞事件 TypeScirpt 声明Map类型变量 TypeScript 声明函数类型变量
旋转力学例子
kingBook · 2025-03-15 · via 博客园 - kingBook
package {
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.utils.getTimer;

    public class RotationExample extends Sprite {

        private var rotatingObject: Shape; // 要旋转的对象
        private var rotateSpeed: Number = 0;
        private var time: Number = getTimer();

        public function RotationExample() {
            createRotatingObject();
            addEventListener(Event.ENTER_FRAME, update);
        }

        // 创建旋转对象
        private function createRotatingObject(): void {
            rotatingObject = new Shape();

            // 绘制一个矩形(注册点在中心)
            rotatingObject.graphics.beginFill(0xFF0000);
            rotatingObject.graphics.drawRect(-50, -30, 100, 60); // 中心在 (0,0)
            rotatingObject.graphics.endFill();

            // 设置初始位置
            rotatingObject.x = stage.stageWidth / 2;
            rotatingObject.y = stage.stageHeight / 2;

            addChild(rotatingObject);
        }

        // 更新旋转
        private function update(event: Event): void {
            // t=FL
            // 其中 t 是力矩,F 是作用力,L 是力臂(即力的作用点到旋转轴的垂直距离)
            const F: Number = 10;
            const L: Number = 1;
            const t: Number = F * L;

            // t=mr^2a
            // 其中 t 是力矩,m 是质量, r 是质心到旋转轴的距离,a 是角加速度

            // t=Ia
            // 其中 t 是力矩,旋转惯量 I=mr^2, a 是角加速度
            const m: Number = 10;
            const r: Number = 1000;
            const I: Number = m * r * r;


            var dt = getTimer() - time;
            time = getTimer();

            var a: Number = t / I * (dt * dt);
            a *= 180 / Math.PI;

            rotateSpeed += a;
            trace("a:" + a);
            rotatingObject.rotation += rotateSpeed;
        }
    }
}