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

推荐订阅源

L
LangChain Blog
C
Check Point Blog
博客园 - Franky
V
Visual Studio Blog
云风的 BLOG
云风的 BLOG
aimingoo的专栏
aimingoo的专栏
Microsoft Security Blog
Microsoft Security Blog
V2EX - 技术
V2EX - 技术
AI
AI
Hacker News - Newest:
Hacker News - Newest: "LLM"
Jina AI
Jina AI
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
H
Hacker News: Front Page
H
Hackread – Cybersecurity News, Data Breaches, AI and More
O
OpenAI News
Attack and Defense Labs
Attack and Defense Labs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
爱范儿
爱范儿
H
Heimdal Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
G
Google Developers Blog
G
GRAHAM CLULEY
V
V2EX
The Register - Security
The Register - Security
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
Schneier on Security
Schneier on Security
M
MIT News - Artificial intelligence
Stack Overflow Blog
Stack Overflow Blog
Help Net Security
Help Net Security
大猫的无限游戏
大猫的无限游戏
C
CERT Recently Published Vulnerability Notes
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
The Last Watchdog
The Last Watchdog
J
Java Code Geeks
S
Secure Thoughts
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
量子位
NISL@THU
NISL@THU
K
Kaspersky official blog
Engineering at Meta
Engineering at Meta
T
Threatpost
Recent Commits to openclaw:main
Recent Commits to openclaw:main
宝玉的分享
宝玉的分享
Security Latest
Security Latest
T
The Exploit Database - CXSecurity.com
博客园_首页
A
Arctic Wolf

夜行人

回家路上 第一期的直播演示项目 震动检测器 正能量 在线参观CodeLab Neverland 发布 CodeLab Adapter 3.3.1 DynamicTable 之 纸糊方向盘 CodeLab DynamicTable: 一个可实施的技术方案 CodeLab Insight 发布 Alpha 版 情人节 Home Assistant 周报 && IoT 周报 (02) Joplin: 关注隐私的 Evernote 开源替代软件 浏览器的未来与 Web 传感器 Home Assistant 周报 && IoT 周报 (01) 百宝箱(01) 论自由 介绍 WebThings Home Assistant 周报 && iot 周报 (00) 百宝箱(00) 毛姆读书心得 传世之作 周末徒步 CodeLab Adapter ❤️ Jupyter/Python 航班 躲雨 夏令营途中 [译]思想--作为一种技术 The future of coding 美国之行 三门问题的程序模拟 从Python转向Pharo https://blog.just4fun.site/post/iot/iot-open-source-projects/ Python异步编程笔记 https://blog.just4fun.site/post/iot/iot-open-source-hardware-community/ 万物积木化开发者社区 CodeLab ❤️ Blender Scratch3技术分析之云变量 API(第7篇) [译]对管道(Pipes)的偏爱 [译]提出正确的问题比得到正确答案更重要 蓝牙设备与Scratch3.0 创建你的第一个Scratch3.0 Extension Scratch3技术分析之项目内部数据(第6篇) Scratch3技术分析之社区 API(第5篇) Scratch3技术分析之User API(第4篇) Scratch3技术分析之项目主页API(第3篇) Scratch3技术分析之静态资源API(第2篇) Scratch3.0、micro:bit与Windows7 https://blog.just4fun.site/post/iot/zerynth-vs-micropython/ 核聚变、方所与半宅空间 可视化编程为何是个糟糕的主意 codelab.club周末聚会 关于codelab.club '下一件大事'是一个房间 Hungry Robot - Eat everything 编程作为一种思考方式 今日简史 史蒂夫·乔布斯传 罗素自选文集 https://blog.just4fun.site/post/edx/tianjin-scratch-ai/ https://blog.just4fun.site/post/edx/richie-cms-openedx/ 徒步武功山 WebUSB与micro:bit 积木化编程与3D场景 夜宿武功山顶 scratch3-adapter接入优必选Alpha系列机器人 https://blog.just4fun.site/post/edx/video-migration-note/ scratch3-adapter重构笔记 https://blog.just4fun.site/post/edx/edx-community-members/ 两种硬件编程风格的比较 使用micro:bit自制PPT翻页笔 柏拉图对话集 scratch3.0 + micro:bit 七月电影放映计划 非营利组织的管理 Screenly--用树莓派让任何屏幕变为可编程的数字标牌 以最佳实践开始你的Django项目 micro:bit与事件驱动 为Scratch3.0设计的插件系统(上篇) OCR应用一例 近两年读过的一些好书 blockly开发之使用python驱动浏览器中的turtle(2) 牛顿新传 文学理论入门 逻辑的引擎 人生的意义 blockly开发之生成并运行js代码(1) blockly开发之hello world(0) micro:bit使用笔记 神器之Termux https://blog.just4fun.site/post/iot/micropython-notes/ Cozmo what is this Scratch的前世今生 下段旅程 我行在远方 爆裂 途中杂记 https://blog.just4fun.site/post/edx/open-edx-startup/ cozmo系列之入门 - 有性格且可编程的机器人 PaperWeekly开发笔记 创业二三事
Spline library for Snap!
种瓜 · 2024-06-14 · via 夜行人

文章目录

中文版本

Preface

My interest in 3D environments came from this paper by Croquet team.

I learned this perspective on interactive graphical computing from Alan Kay: the power of desktop metaphor/GUI is psychological, it create a “illusion” for users, as if things are right there on the screen, so users can transfer their real-world experience, just like dealing with physical objects, to interacting with virtual objects on the screen.

From this perspective, we naturally crave a 3D environment because it can further enhance this “user illusion” that things exist in a virtual 3D space rather than on a 2D “desktop.” As a result, users can more easily transfer their experiences from the real world (the real world is a kind of 3D space).

These ideas focus on making computing adapt to humans, rather than making humans adapt to computing.

Introducing 3D world into Snap!

The stage provided by Snap! is usually used to make 2D projects. I was eager to introduce 3D world into Snap!.

There are many ways to achieve goals:

The iframe library provides this possibility.

My idea is:

  • Introducing web-based 3D world into Snap! using the iframe library.
  • With postMessage API, Snap! can communicate with the 3D world inside an iframe

I need to choose a 3D engine to demonstrate how to implement the above ideas. After some comparison, I chose Spline, which is simple and easy. Spline has many similarities with Scratch, and it greatly reduces the difficulty of 3D creation.

It is possible to create a 3D editor(based on threejs or babylonjs) for Snap!, just like Snap!’s Bitmap Paint Editor/Vector Paint Editor, deeply integrated into Snap!. The downside of doing this is the development workload is huge, and it is doubtful whether it is as easy to use. I ultimately abandoned this idea and instead started thinking about:

Which 3D editor is easy to use and exposes an API for interaction? If such a editor exists, we can consider it as an “external editor” for Snap!

Spline is responsible for creating 3D projects and exposing API and Snap! is responsible for programming and control. Operating a Spline project in Snap! is similar to operating a MicroBlocks project in Snap!. Spline and MicroBlocks is responsible for “internal Programming”, providing services externally, while Snap! acts as a client using these services.

demo 1

Project link (Click to Run)

You can export the project and load it in Snap!Cloud, remember to enable JavaScript extensions

Spline project used for demonstration, remixed from Little World Kawaii Pig

The world url filled in Snap! is https://prod.spline.design/s7FG1KdbdsyW8yOY/scene.splinecode (FAQ explains how to get the world url of a project)

demo2

Project link (Click to Run)

Spline project used for demonstration, remixed from Mini House - Conditional Logic

The world url filled in Snap! is https://prod.spline.design/nO5gRl8xdZ5gp4UJ/scene.splinecode

demo3: get and set variable

Project link (Click to Run)

Spline project used for demonstration, remixed from 3D Text - Blue.

The world url filled in Snap! is https://prod.spline.design/CJdfFOXzOrARU5Nz/scene.splinecode

About the usage of variables in Spline, refer to this tutorial

FAQ

How to get the world url

How to self-host project files?

Taking demo 2 (https://prod.spline.design/dP5NwOaNd2IR5Npm/scene.splinecode) as an example, you can download it, store it on your own server (I put it at: https://wwj718.github.io/post/img/scene.splinecode ), and then load it.

Project link (Click to Run)

How does the open world url block work?

open world url block requires a url parameter, like https://prod.spline.design/nO5gRl8xdZ5gp4UJ/scene.splinecode, you can get the url from the Export button of a Splne project.

Within open world url block , it will pass the url to this iframe page: https://wwj718.github.io/Snap-Spline-Demo?project=https://prod.spline.design/nO5gRl8xdZ5gp4UJ/scene.splinecode

The source code of the iframe page is here: Snap-Spline-Demo.

What APIs does Spline expose?

Here is the API description.

These APIs determine how external systems (such as Snap!) can interact with Spline projects.

What is the use of dynatalk-over-postmessage blocks

Everything is an object
Objects communicate via messages
The object interprets the message it understands
– Alan Kay

The browser provides the postMessage API for communicating with iframe pages, which is an asynchronous communication (pub/sub) method. Sometimes we want synchronous communication (such as the ask _ for _ blocks of the Spline library), similar to RPC or function call. Dynatalk can achieve this.

Creating dynatalk-over-postmessage is esay. It only needs to switch the message channel from MQTT to postMessage. Specifically, the mechanism for receiving and sending messages needs to be adjusted.

References