visionforge/demo/playground/notebooks/common-demo.ipynb

145 lines
4.6 KiB
Plaintext
Raw Normal View History

2023-07-19 22:25:32 +03:00
{
"cells": [
{
"cell_type": "code",
2023-07-20 09:13:24 +03:00
"execution_count": 2,
"metadata": {
2023-07-20 09:13:24 +03:00
"ExecuteTime": {
"end_time": "2023-07-20T06:12:13.305060400Z",
"start_time": "2023-07-20T06:12:13.011273800Z"
}
},
2023-07-19 22:25:32 +03:00
"outputs": [],
"source": [
"@file:Repository(\"*mavenLocal\")\n",
"@file:Repository(\"https://repo.kotlin.link\")\n",
"@file:Repository(\"https://maven.pkg.jetbrains.space/spc/p/sci/dev\")\n",
2023-07-20 09:13:24 +03:00
"@file:DependsOn(\"space.kscience:visionforge-jupyter-common-jvm:0.3.0-dev-11\")"
2023-07-19 22:25:32 +03:00
]
},
{
"cell_type": "code",
2023-07-20 09:13:24 +03:00
"execution_count": 3,
2023-07-19 22:25:32 +03:00
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
2023-07-20 09:13:24 +03:00
},
"ExecuteTime": {
"end_time": "2023-07-20T06:12:19.603077Z",
"start_time": "2023-07-20T06:12:19.419504300Z"
}
},
2023-07-20 09:13:24 +03:00
"outputs": [
{
"data": {
"text/html": "<p style=\"color: blue;\">Starting VisionForge server on http://localhost:7777</p>\n"
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
2023-07-19 22:25:32 +03:00
"source": [
"vf.startServer()"
]
2023-07-19 22:25:32 +03:00
},
{
"cell_type": "code",
2023-07-20 09:13:24 +03:00
"execution_count": 4,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
2023-07-20 09:13:24 +03:00
},
"ExecuteTime": {
"end_time": "2023-07-20T06:12:21.490069100Z",
"start_time": "2023-07-20T06:12:20.694188600Z"
}
},
2023-07-20 09:13:24 +03:00
"outputs": [
{
"data": {
"text/html": "<div id=\"fragment[1645474043/2315898832]\">\n <h1>AAA</h1>\n <div id=\"output[vision[302766000]]\" class=\"visionforge-output\" data-output-name=\"vision[302766000]\" data-output-connect=\"ws://localhost:7777/content-0/ws\">\n <script type=\"text/json\" class=\"visionforge-output-data\">\n{\n \"type\": \"group.solid\",\n \"children\": {\n \"@ambientLight\": {\n \"type\": \"solid.light.ambient\"\n },\n \"@static[1326263213]\": {\n \"type\": \"solid.box\",\n \"xSize\": 100.0,\n \"ySize\": 100.0,\n \"zSize\": 200.0\n },\n \"@static[1813044036]\": {\n \"type\": \"solid.sphere\",\n \"properties\": {\n \"position\": {\n \"x\": 300\n }\n },\n \"radius\": 100.0\n }\n }\n}\n</script>\n </div>\n <div id=\"output[vision[1326029936]]\" class=\"visionforge-output\" data-output-name=\"vision[1326029936]\" data-output-connect=\"ws://localhost:7777/content-0/ws\">\n <script type=\"text/json\" class=\"visionforge-output-data\">\n{\n \"type\": \"vision.plotly\",\n \"meta\": {\n \"data\": {\n \"type\": \"scatter\",\n \"x\": [\n 1,\n 2,\n 3,\n 1\n ],\n \"y\": [\n 1,\n 2,\n 3,\n 4\n ],\n \"@index\": \"0\"\n }\n }\n}\n</script>\n </div>\n</div>\n<script type=\"text/javascript\">VisionForge.renderAllVisionsById(\"fragment[1645474043/2315898832]\");</script>\n"
},
"execution_count": 4,
"metadata": {
"text/html": {
"isolated": true
}
},
"output_type": "execute_result"
}
],
2023-07-19 22:25:32 +03:00
"source": [
"vf.page {\n",
" h1 { +\"AAA\" }\n",
" vision {\n",
" solid {\n",
" ambientLight()\n",
" box(100, 100, 200)\n",
"\n",
" sphere(100) {\n",
" x = 300\n",
" }\n",
" }\n",
" }\n",
"\n",
" vision {\n",
" plotly {\n",
" scatter {\n",
" x(1, 2, 3, 1)\n",
" y(1, 2, 3, 4)\n",
" }\n",
" }\n",
" }\n",
"}"
]
2023-07-19 22:25:32 +03:00
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [],
"source": [
"vf.stopServer()"
]
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false
}
2023-07-19 22:25:32 +03:00
}
],
"metadata": {
"kernelspec": {
"display_name": "Kotlin",
"language": "kotlin",
"name": "kotlin"
},
"ktnbPluginMetadata": {
"isAddProjectLibrariesToClasspath": false
},
2023-07-19 22:25:32 +03:00
"language_info": {
"codemirror_mode": "text/x-kotlin",
2023-07-19 22:25:32 +03:00
"file_extension": ".kt",
"mimetype": "text/x-kotlin",
"name": "kotlin",
"nbconvert_exporter": "",
2023-07-19 22:25:32 +03:00
"pygments_lexer": "kotlin",
"version": "1.8.20"
2023-07-19 22:25:32 +03:00
}
},
"nbformat": 4,
"nbformat_minor": 4
2023-07-19 22:25:32 +03:00
}