Popular New Releases in Augmented Reality
aframe
v1.2.0
engine
v1.53.2
Relativty
Relativty 2 early Release
MixedRealityToolkit-Unity
Microsoft Mixed Reality Toolkit v2.7.3
openvr
v1.16.8
Popular Libraries in Augmented Reality
by jeromeetienne html
15308 MIT
Efficient Augmented Reality for the Web - 60fps on mobile!
by cyrildiagne typescript
14263 MIT
Cut and paste your surroundings using AR
by aframevr javascript
13681 MIT
:a: web framework for building virtual reality experiences.
by playcanvas javascript
7301 MIT
Fast and lightweight JavaScript game engine built on WebGL and glTF
by olucurious swift
6962
A curated list of awesome ARKit projects and resources. Feel free to contribute!
by relativty c++
5416 GPL-3.0
An open source VR headset with SteamVR supports for $200
by microsoft csharp
5032 MIT
Mixed Reality Toolkit (MRTK) provides a set of components and features to accelerate cross-platform MR app development in Unity.
by ProjectDent swift
4993 MIT
Combines the high accuracy of AR with the scale of GPS data.
by ValveSoftware c++
4789 BSD-3-Clause
OpenVR SDK
Trending New libraries in Augmented Reality
by cyrildiagne typescript
14263 MIT
Cut and paste your surroundings using AR
by AR-js-org javascript
3449 MIT
Image tracking, Location Based AR, Marker tracking. All on the Web.
by pmndrs javascript
1002 MIT
🤳 VR/AR with react-three-fiber
by felixmariotto javascript
686 MIT
⏹ Make VR user interfaces for Three.js
by fabio914 c
641 GPL-2.0
Mixed Reality app for iOS
by hiukim javascript
621 MIT
Web Augmented Reality. Image Tracking, Face Tracking. Tensorflow.js
by lllyasviel python
550 Apache-2.0
Generating Digital Painting Lighting Effects via RGB-space Geometry (SIGGRAPH2020/TOG2020)
by ju1ce c++
510 MIT
Full-body tracking in VR using AprilTag markers.
by googlesamples csharp
445 Apache-2.0
ARCore Depth Lab is a set of Depth API samples that provides assets using depth for advanced geometry-aware features in AR interaction and rendering. (UIST 2020)
Top Authors in Augmented Reality
1
29 Libraries
9752
2
20 Libraries
2418
3
15 Libraries
15863
4
14 Libraries
98
5
13 Libraries
1147
6
13 Libraries
144
7
13 Libraries
4977
8
12 Libraries
5925
9
11 Libraries
71
10
10 Libraries
1105
1
29 Libraries
9752
2
20 Libraries
2418
3
15 Libraries
15863
4
14 Libraries
98
5
13 Libraries
1147
6
13 Libraries
144
7
13 Libraries
4977
8
12 Libraries
5925
9
11 Libraries
71
10
10 Libraries
1105
Trending Kits in Augmented Reality
Projection Based AR is an Image/video projection technique that can be extended and reinforce visual data by throwing images on the surface of 3D objects. Graphical and Imaginary representation is straightforward to implement with Projection Based AR techniques that standard lighting techniques cannot express. This kit helps users to experience the shopping experience like wearing Glasses, cap, earring in AR mode. Aframe is a framework for building virtual reality websites. This project will show you how to build an e-commerce site using aframe, AR.js, mind-AR.js, and Sketch-three.js.
Aframe has many components that can be used together or separately in your project. You may already be familiar with React or Three.js - these are two of the most common technologies used in web development today. They're used here as well! Aframe brings together these technologies and provides a simple interface for building virtual reality experiences on the web while maintaining the power of React and Three.js behind the scenes.
Troubleshooting
- While running batch file, if you encounter Windows protection alert, select More info --> Run anyway
- During kit installer, if you encounter a Windows security alert, click Allow
For a detailed tutorial on installing & executing the solution as well as learning resources including training & certification opportunities, please visit the OpenWeaver Community
Development Environment
Visual studio code IDE is used for this development. It becomes easy and simple to develop an interactive UI with Visual studio code.
AR Libraries
A-Frame is an open-source web framework used for building Augmented reality (AR) experiences. Web-based augmented reality (WebAR) is the most advanced technology that allows users to access AR experiences directly from their smartphones. Three.js is the open-source web framework used to develop augmented reality (AR) projects.
Support
If you need help using this kit, you may reach us at the OpenWeaver Community.
AR Core app allows users to experience augmented reality on their Android devices. This kit helps developers and users to experience their own 3d models.
The users have the liberty to choose their own 3d models with all the fun elements also. Please see below a sample solution kit to jumpstart your solution on AR App using Android Kit. To use this kit to build your own solution, scroll down to the Kit Deployment Instructions sections.
Development Environment
The Android Studio IDE is open source and used for this development. It has a rich UI development environment with templates to give new developers launching their innovations into Android development.
Android Libraries
ARCore is the advanced platform that enables Android app developers and users to quickly and easily build AR experiences into their mobile apps and games.
Google Sceneform is an open-source 3D framework that makes it easy for you to build ARCore apps.
Android-Gradle is the open-source Android framework used to develop AR projects.
AR Fragments are used to build these ARCore apps.
Instruction to Replace 3d Models
- To place your own 3d model, initially, you need to set up your Android studio with "Google Sceneform Tool (Beta)"
- To install Google Sceneform Tool just follow the below steps : a. Go to file > settings b. In settings, click on 'plugins' c. In plugins search for "Google Sceneform Tool" in Marketplace d. Once you find, Install and restart the Android Studio
- Place your 3d model obj and mtl file in sampledata folder in the application Note:- Name of the obj file should be in lowercase
- Make a raw folder under app > src > main > res > raw
- Right-click on the obj file and generate the Sceneform for your 3d model under the raw folder.
Support
If you need help to use this kit, you can email us at kandi.support@openweaver.com or direct message us on Twitter Message @OpenWeaverInc.
Most JavaScript libraries support marker-based AR, where users scan a physical marker with their device’s camera to trigger an AR experience.
Some libraries support markerless AR, which uses object recognition to trigger AR experiences without requiring a physical marker. Here are the top JavaScript Augmented Reality libraries used to create web AR experiences. AR libraries support the display of 3D models in AR, which will allow developers to create immersive experiences which blend digital content with the real world. It supports the display of image and video overlays in AR which can be used for displaying information or creating interactive experiences.
It uses advanced tracking algorithms for tracking the orientation and position of the device in real-time, which will allow the AR content to be accurately placed and aligned with the real world. These libraries are optimized for best performance with the help of techniques like feature and image recognition for reducing the amount of processing required for tracking the device’s orientation and position.
Here is the list of top 19 JavaScript Augmented Reality libraries that are handpicked to help developers:
three.js
- Is a JavaScript library that makes creating and displaying 3D graphics in a web browser easier.
- Is one of the most popular 3D graphics libraries for the web and is widely used by web designers and developers for creating immersive and interactive experiences.
- Uses WebGL, a web standard to render 3D graphics, for creating high-performance graphics which can be displayed in a web browser.
AR.js
- Is a JavaScript library to create AR experiences on the web which uses computer vision to enable marker-based AR experiences without additional plugins or software.
- Is a lightweight library for Augmented Reality on the web with features like Location-based AR, Marker Tracking, and Image Tracking.
- Supports marker-based AR that will allow users to scan physical markers with their device’s camera to trigger AR experiences.
three.ar.js
- Is a JavaScript library that extends Three.js and AR.js to provide a framework for creating AR experiences in a web browser.
- Is designed to simplify the process of creating an AR experience by offering utilities and tools which integrate seamlessly with AR.js and Three.js.
- Is optimized for use on mobile devices and supports both Android and iOS.
webxr
- The WebXR device API to access VR and AR devices, like head-mounted displays and sensors on the Web.
- Is designed for creating immersive augmented reality and virtual experiences in web browsers.
- Is designed to be easy to set up and use with a simple API, allowing developers to get started quickly.
jeelizFaceFilter
- Is lightweight and does not include a 3D engine or third-party library.
- Is a JavaScript library that detects and tracks the face in real time from the camera video feed captured with WebRTC.
- Offers various demonstrations using the main WebGL 3D engines, which can overlay 3D content for AR applications.
viro
- Is a platform for developers to build Augmented and Virtual Reality experiences rapidly.
- Is a cross-platform AR/VR development platform that allows developers to create immersive experiences for web, virtual reality, and mobile device headsets.
- Provides a suite of features and tools for making creating high-quality AR and VR experiences easier.
exokit
- Is an open source JavaScript engine to create and run immersive experiences in virtual reality headsets, web browsers, and other platforms.
- Offers various features and tools, allowing developers to create and deploy immersive experiences and applications.
- Supports virtual experiences by allowing developers to create immersive experiences which can run on virtual reality headsets.
js-aruco
- Is a JavaScript library for marker-based augmented reality.
- Is an implementation of the ARToolKit library, allowing developers to create marker-based AR experiences in web browsers.
- Includes algorithms for detecting markers in real-time video streams, allowing developers to create experiences that respond to the physical world.
React-Web-AR
- Is based on the WebXR API and Three.js library, making creating high-quality AR experiences in the browser easier.
- Includes various components and tools for creating animations, 3D models, and other assets, making it easier to create high-quality AR content.
- Supports image tracking, allowing developers to create experiences triggered by specific patterns or images.
ar-facedoodle
- Is a JavaScript library that can enable developers to create AR experiences that track and draw on the user’s face in real-time.
- Is based on the WebRTC and TensorFlow.js libraries, making it possible to create a high-quality AR experience in web browsers without additional software or plugins.
- Is easy to set up and use with a simple API, allowing developers to get started quickly.
jeelizAR
- Is a JavaScript Object Detection lightweight library for AR that uses convolutional neural networks running on the GPU with WebGL.
- Is designed to work on various platforms, like mobile devices and desktops, and is compatible with various browsers.
- Includes algorithms to detect markers in real-time video streams, allowing developers to create experiences that respond to the physical world.
threex.webar
- Is a threex extension for three.js, which offers an easy-to-use extension for experimenting with augmented reality and three.js.
- Is built on top of the Three.js library, making it possible to create high-quality AR experiences with 3D graphics and animation.
- Has an active community of contributors and developers, making it easy to get support and help when required.
WebXR-emulator-extension
- Is a browser extension that helps your WebXR content creation and enables you to run WebXR applications on your browser without any XR devices.
- Includes multiple XR devices emulation, graphical device emulator control with Three.js, and cross browsers support with WebExtensions API.
- Allows developers to customize the environment they are testing their WebEX projects in, like adjusting the room lighting, scale, and other parameters.
webxr-polyfill
- Is a JavaScript implementation of the WebXR Device API and the WebXR Gamepad Module.
- Allows developers to write against the latest specifications, offering support if run on browsers that implement the WebVR 1.1 spec or on mobile devices.
- Offers a fallback mechanism for legacy browsers and provides additional functionality unavailable in native WebXR API.
3dio-js
- Is a JavaScript library that enables developers to create interactive 3D audio experiences in web browsers.
- Is built on top of the Web Audio API and Three.js, making it easy to create high-quality audio experiences with 3D spatialization.
- Various customization options allow developers to adjust the audio spatialization, sound effects, and other parameters to suit their requirements.
wasm-sudoku-solver
- Is a JavaScript library that uses WebAssembly to offer an efficient Sudoku-solving algorithm in web browsers.
- Is designed for solving sudoku puzzles quickly and accurately, making it a valuable tool for developers creating Sudoku puzzle applications or games.
- Various customization options allow developers to adjust the solving algorithm and other parameters to suit their requirements.
webxr-polyfill
- Is a JavaScript library that offers support for the WebXR API on browsers that do not natively support it.
- Is designed to enable responsive and immersive AR and VR experiences on the web, like support for hand tracking, head-mounted displays, and other features.
- Includes optimizations for performance, including asynchronous loading of resources, reducing latency, and minimizing the impact on CPU and memory usage.
aframe-ar
- Is a JavaScript library that offers an effortless way to create AR experiences on the web.
- Includes a range of customization options, allowing developers to adjust the appearance and behavior of their AR experiences
- Offers an accessible and user-friendly way for developers to create compelling AR experiences on the web.
WebAR-Article
- Is a JavaScript library created by Google AR which offers a straightforward way to embed AR content into web pages.
- Includes various customization options, allowing developers to adjust the behavior and appearance of their AR experiences.
- Can be easily integrated with other JavaScript libraries, making it possible to create more complex AR experiences.
FAQ
1. What advantages does the AR-Display AR library offer for making Augmented Reality?
Here are the advantages of using AR – Display AR library for developing AR experiences:
- Simplified Development: Developers can create AR experiences more easily without starting from scratch. It can significantly reduce development time and effort.
- Hardware Abstraction: It simplifies using various AR devices and sensors by removing complications. No matter what hardware they use, developers can always interact with it consistently.
- Optimized Performance: Optimized Performance helps improve how AR experiences work. It makes rendering more efficient, handles camera inputs, and manages 3D objects.
- Feature Set: It often comes with various built-in features and tools. It can be marker detection, gesture recognition, 3D rendering capabilities, and object tracking.
- Scalability: It helps your AR experiences work well in different situations and places.
- Rapid Prototyping: It helps with quick prototyping and testing of AR concepts. It is essential for iterating on ideas and refining the user experience.
2. How can webcam filters be used to build JavaScript Augmented Reality experiences?
Creating JavaScript-based Augmented Reality experiences using webcam filters involves using computer vision methods. It processes the live video feed from a user’s webcam and overlays virtual elements. We can achieve it by combining JavaScript, HTML, and CSS.
Here is a basic outline of how you can build such experiences:
- Access Webcam Feed: You can use the ‘getUserMedia’ API to access the user’s webcam feed in the browser. It allows you to request permission to access the webcam and receive a live video stream.
- Canvas Rendering: You can make a canvas on your webpage to show the webcam and AR elements. You can use JavaScript to capture frames from the webcam and render them onto the canvas.
- Computer Vision Libraries: It can help track objects, detect features, and process images. It assists in finding markers, applying filters to video frames, and tracking movements.
- Marker Detection: The camera can display virtual markers by recognizing patterns or images.
- Applying Filters: You can improve videos by adding CSS and HTML filters and effects. You can use this for image overlays, animations, and color adjustments.
- Interaction and Animation: JavaScript can make interactive elements respond to user actions. It can also respond to movements detected by the webcam. Implement animations and transformations based on user interactions.
- Testing and Debugging: To ensure your AR experience works on all devices, test and debug it. Debug any issues related to webcam access, rendering, or the application of filters.
- Deployment: To share your AR experience online, deploy it on a web server or hosting platform.
3. Can you create immersive and interactive experiences using a JavaScript AR library?
Creating immersive and interactive AR experiences using a JavaScript AR library. The difficulty of the task depends on the library you select. It can be easy or hard. Here is a breakdown of the factors to consider:
Advantages:
- Familiar technology
- Web-based
- Quick Prototyping
- Community Support
- Web Standards
Disadvantages:
- Complexity
- Performance
- Learning Curve
- Compatibility
- Hardware Limitations
- Advanced Interactions
4. What AR experiences can you have with a JavaScript AR library?
JavaScript AR libraries can make interactive and engaging experiences using marker-based AR. The camera finds special markers, like pictures or patterns, to trigger these experiences. Here are many types of marker-based AR experiences:
- Image Overlay
- 3D Model Augmentation
- Informational Displays
- Virtual Try-on
- Interactive Games
- Educational Tools
- Navigation and Wayfinding
- Art and Creativity
- Social Sharing
- Animation Stories
- Training and Simulations
- AR Marketing Campaigns
5. Are there any limitations with JavaScript augmented reality library?
Yes, JavaScript AR libraries come with limitations. The limitations can affect the complexity of experiences you can create. They can also impact how well your applications work and how users experience them. Here are some common limitations associated with JavaScript AR libraries:
- Performance
- Device Compatibility
- Tracking Accuracy
- Limited Features
- Latency
- Battery Drain
- Network Dependency
- Marker Design Constraints
- Web Browser Limitations
- Learning Curve
- Limited Offline Functionality
- Privacy Concerns
- Lack of Native Integration
6. Which libraries are popular for tracking AR types like markers, locations, and images?
Here are some popular libraries for various types of AR experiences:
- Marker-based AR
- AR.js
- Vuforia
- Wikitude
- Location-based AR
- GeoAR
- Google ARCore and Apple ARKit
- Image Recognition-Based AR
- EasyAR
- Vuforia
- Wikitude
7. How can an existing JavaScipt AR library be integrated into a project or website?
Follow these steps to add a JavaScript AR library to your project or website. Here is how you can integrate:
- Choose the library
- Include the library files
- Set Up HTML structure
- Access Camera Feed
- Initialize the Library
- Configure and Customize
- Implement AR interactions
- Style and UI
- Testing and Debugging
- Deployment
- Ongoing Maintenance
8. Can developers find tutorials or guides for creating augmented reality with these libraries?
You can use JavaScript AR libraries to create AR experiences. Find online tutorials and guides. Here are some places to find tutorials and guides:
- Official documentation
- YouTube
- Online Learning Platforms
- Blogs and Websites
- Forums and Communities
- GitHub Repositories
- AR library Websites
- Social Media
- Webinars and Conferences
- Community Workshops
Virtual, Augmented, and Mixed realities bring in additional dimensions of collaboration in this distributed world. This collection represents a starter collection to experiment with different mixed reality use cases. It showcases toolkits, remote work use cases, and other exciting use cases for you to try across C#, JavaScript, and Java. If you have specific technologies or use cases in mind, use our search to find libraries specific to you.
With Facebook rebranding itself as Meta and multiple corporations betting on the Metaverse, the interest for development on Metaverse and Extended Reality (XR) have peaked. And it’s no surprise: XR technologies are changing the way we interact with our environment while offering immersive experiences. But what is Extended Reality (XR)? Extended Reality (XR) is an environment or experience that combines virtual and physical realities through the use of augmented reality (AR), mixed reality, virtual reality (VR) or any similar immersive technologies. Think Pokemon Go or The Walking Dead: Our World — games that combine your phone’s camera with a layer of 3D animated objects superimposed on top of it. Or imagine being able to virtually open up a virtual world inside of real-world buildings, like in Ready Player One. Whether you’re new to XR and just starting out, or you’re looking for specific tools to help you in your development process, you can use the following open source resources for your Extended Reality (XR) applications.
Trending Discussions on Augmented Reality
Using Microsoft Authentication Library (MSAL) in Unity for SSO in iOS app
AttributeError: 'numpy.ndarray' object has no attribute 'set'
Move the centre of the force within Reality Composer scene
How do I include rows from dataframe that contain certain keywords
Jquery .resizable function - resize icon not displaying properly
In which case the SLAM technique is used?
Why does my video only play sound and no video with ARJS?
How to fix AR connected issue in my device?
How to place a 3D model on top of a reference image with RealityKit?
ARKit does not recognize reference images
QUESTION
Using Microsoft Authentication Library (MSAL) in Unity for SSO in iOS app
Asked 2022-Mar-16 at 09:31We develop a bunch of augmented reality applications for our company. The applications are based on the game engine Unity (currently in the version 2020.3.7f1). Now, we're facing the point that we'd like to implement a SSO method in our apps, so every member of our company authenticates himself with his company user credentials. To authenticate the user we want to / have to use the Microsoft identity platform and thus the Microsoft Authentication Library (MSAL).
We already created an client on Azure with a client id, redirect uri, authority uri, endpoint, tenant, etc and it was tested successfully with an official sample project by Microsoft (https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-v2-ios).
But now we stuck at the point to establish this process in Unity. We created the MSAL library dll (https://github.com/AzureAD/microsoft-authentication-library-for-dotnet), imported it into Unity and called it by using the namespace Microsoft.Identity.Client. Due to security reasons we're only allowed to use PublicClientApplicationBuilder (which makes totally sense) so we need the web based login screen. The problem is that we can't implement a web view in Unity where the user can sign in to Microsoft and we can parse the received token out of the web view into our app for further communications.
We did a lot of internet research to find a solution but there are only some posts about MSAL in Unity in combination with Android and other posts which reference to the git repos I mentioned before.
How can we use MSAL in Unity for iOS devices?
Example code:
1 IPublicClientApplication PublicClientApp = PublicClientApplicationBuilder
2 .Create(kClientID)
3 .WithRedirectUri(kRedirectUri)
4 .WithAuthority(new Uri(kAuthority))
5 .Build();
6 IEnumerable<string> scopes = new List<string> { "https://graph.microsoft.com/.default" };
7 AuthenticationResult result;
8 result = await PublicClientApp.AcquireTokenInteractive(scopes)
9 .ExecuteAsync();
10
11 result = await PublicClientApp
12 .AcquireTokenInteractive(scopes)
13 .WithParentActivityOrWindow(new object)
14 .ExecuteAsync();
15
16 Debug.Log(result.AccessToken);
17
ANSWER
Answered 2021-Nov-16 at 13:45The standard solution for mobile is the AppAuth pattern, which involves use of an integrated system browser to sign the user in. See this code example article for how that looks, so that you understand the required behaviour.
So it looks like they key thing to do with iOS is to avoid logins via webviews and tell MSAL to use an ASWebAuthenticationSession window - this Microsoft article explains how.
QUESTION
AttributeError: 'numpy.ndarray' object has no attribute 'set'
Asked 2022-Feb-16 at 18:33when I write this code: (my entire code, school project on Augmented Reality) Everything worked perfectly until I tried to run the video. ...........................................................................................................................................................................................................
1import cv2
2import numpy as np
3
4cap=cv2.VideoCapture(2)
5imgTarget=cv2.imread('F1racecars.jpeg')
6vidTarget= cv2.VideoCapture('F1racecars.mp4')
7
8success, vidTarget = vidTarget.read()
9imgTarget=cv2.resize(imgTarget,(640,360))
10hT, wT, cT = imgTarget.shape
11vidTarget=cv2.resize(vidTarget,(wT,hT))
12
13
14orb = cv2.ORB_create(nfeatures=1000)
15kp1, des1 = orb.detectAndCompute(imgTarget,None)
16
17detect = False
18fcount = 0
19
20
21while True:
22 success, imgWebcam= cap.read()
23 imgAug = imgWebcam.copy()
24
25 imgWarp = np.zeros((imgWebcam.shape[1], imgWebcam.shape[0],imgWebcam.shape[2]))
26 masknew = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1],imgWebcam.shape[2]), np.uint8)
27 maskInv = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1], imgWebcam.shape[2]), np.uint8)
28 Mergecamfeed = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1], imgWebcam.shape[2]), np.uint8)
29 ARfinal = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1], imgWebcam.shape[2]), np.uint8)
30
31 if detect is False:
32 vidTarget.set(cv2.CAP_PROP_POS_FRAMES,0)
33 fcount =0
34 else:
35 if fcount == vidTarget.get(cv2.CAP_PROP_FRAME_COUNT, 0):
36 vidTarget.set(cv2.CAP_PROP_POS_FRAMES, 0)
37 fcount = 0
38 success, vidTarget= vidTarget.read()
39 vidTarget= cv2.resize(vidTarget, (wT, hT))
40
41 kp2, des2 = orb.detectAndCompute(imgWebcam,None)
42
43 if des2 is None: print(False)
44 else:
45 bf = cv2.BFMatcher()
46 featmatch = bf.knnMatch(des1,des2,k=2)
47 good=[]
48 for m,n in featmatch:
49 if m.distance < 0.75 * n.distance: good.append(m)
50 print(len(good))
51
52 if len(good)>20:
53 detect = True
54 srcpts = np.float32([kp1[m.queryIdx].pt for m in good]).reshape(-1, 1, 2)
55 dstpts = np.float32([kp2[m.trainIdx].pt for m in good]).reshape(-1, 1, 2)
56
57 matrix, mask = cv2.findHomography(srcpts,dstpts, cv2.RANSAC, 5)
58 print(matrix)
59
60 pts = np.float32([[0,0],[0,360],[640,360],[640,0]]).reshape(-1, 1, 2)
61
62 dst = cv2.perspectiveTransform(pts,matrix)
63 cv2.polylines(imgWebcam,[np.int32(dst)],True,(255,0,255),3)
64
65 imgWarp = cv2.warpPerspective(vidTarget,matrix, (imgWebcam.shape[1],imgWebcam.shape[0]))
66
67 cv2.fillPoly(masknew, [np.int32(dst)], (255,255,255))
68
69 maskInv = cv2.bitwise_not(masknew)
70
71 Mergecamfeed = cv2.bitwise_and(imgAug,imgAug,None, mask = maskInv[:,:,0])
72
73 ARfinal = cv2.bitwise_or(imgWarp, Mergecamfeed)
74
75
76 cv2.imshow('imgTarget', imgTarget)
77 cv2.imshow('imgTargetVdo', vidTarget)
78 cv2.imshow('webcam', imgWebcam)
79 cv2.imshow('warp', imgWarp)
80 cv2.imshow('mask', masknew)
81 cv2.imshow('Modified mask', maskInv)
82 cv2.imshow('Aug Image', Mergecamfeed)
83 cv2.imshow('Augmented Reality Final O/P', ARfinal)
84 cv2.waitKey(1)
85 fcount += 1
86
It shows like this:
1import cv2
2import numpy as np
3
4cap=cv2.VideoCapture(2)
5imgTarget=cv2.imread('F1racecars.jpeg')
6vidTarget= cv2.VideoCapture('F1racecars.mp4')
7
8success, vidTarget = vidTarget.read()
9imgTarget=cv2.resize(imgTarget,(640,360))
10hT, wT, cT = imgTarget.shape
11vidTarget=cv2.resize(vidTarget,(wT,hT))
12
13
14orb = cv2.ORB_create(nfeatures=1000)
15kp1, des1 = orb.detectAndCompute(imgTarget,None)
16
17detect = False
18fcount = 0
19
20
21while True:
22 success, imgWebcam= cap.read()
23 imgAug = imgWebcam.copy()
24
25 imgWarp = np.zeros((imgWebcam.shape[1], imgWebcam.shape[0],imgWebcam.shape[2]))
26 masknew = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1],imgWebcam.shape[2]), np.uint8)
27 maskInv = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1], imgWebcam.shape[2]), np.uint8)
28 Mergecamfeed = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1], imgWebcam.shape[2]), np.uint8)
29 ARfinal = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1], imgWebcam.shape[2]), np.uint8)
30
31 if detect is False:
32 vidTarget.set(cv2.CAP_PROP_POS_FRAMES,0)
33 fcount =0
34 else:
35 if fcount == vidTarget.get(cv2.CAP_PROP_FRAME_COUNT, 0):
36 vidTarget.set(cv2.CAP_PROP_POS_FRAMES, 0)
37 fcount = 0
38 success, vidTarget= vidTarget.read()
39 vidTarget= cv2.resize(vidTarget, (wT, hT))
40
41 kp2, des2 = orb.detectAndCompute(imgWebcam,None)
42
43 if des2 is None: print(False)
44 else:
45 bf = cv2.BFMatcher()
46 featmatch = bf.knnMatch(des1,des2,k=2)
47 good=[]
48 for m,n in featmatch:
49 if m.distance < 0.75 * n.distance: good.append(m)
50 print(len(good))
51
52 if len(good)>20:
53 detect = True
54 srcpts = np.float32([kp1[m.queryIdx].pt for m in good]).reshape(-1, 1, 2)
55 dstpts = np.float32([kp2[m.trainIdx].pt for m in good]).reshape(-1, 1, 2)
56
57 matrix, mask = cv2.findHomography(srcpts,dstpts, cv2.RANSAC, 5)
58 print(matrix)
59
60 pts = np.float32([[0,0],[0,360],[640,360],[640,0]]).reshape(-1, 1, 2)
61
62 dst = cv2.perspectiveTransform(pts,matrix)
63 cv2.polylines(imgWebcam,[np.int32(dst)],True,(255,0,255),3)
64
65 imgWarp = cv2.warpPerspective(vidTarget,matrix, (imgWebcam.shape[1],imgWebcam.shape[0]))
66
67 cv2.fillPoly(masknew, [np.int32(dst)], (255,255,255))
68
69 maskInv = cv2.bitwise_not(masknew)
70
71 Mergecamfeed = cv2.bitwise_and(imgAug,imgAug,None, mask = maskInv[:,:,0])
72
73 ARfinal = cv2.bitwise_or(imgWarp, Mergecamfeed)
74
75
76 cv2.imshow('imgTarget', imgTarget)
77 cv2.imshow('imgTargetVdo', vidTarget)
78 cv2.imshow('webcam', imgWebcam)
79 cv2.imshow('warp', imgWarp)
80 cv2.imshow('mask', masknew)
81 cv2.imshow('Modified mask', maskInv)
82 cv2.imshow('Aug Image', Mergecamfeed)
83 cv2.imshow('Augmented Reality Final O/P', ARfinal)
84 cv2.waitKey(1)
85 fcount += 1
86AttributeError: 'numpy.ndarray' object has no attribute 'set'
87
ANSWER
Answered 2022-Feb-16 at 18:33Normally we ask for the full error message, with traceback. That makes it easier to identify where the error occurs. In this case though, set
is only used a couple of times.
1import cv2
2import numpy as np
3
4cap=cv2.VideoCapture(2)
5imgTarget=cv2.imread('F1racecars.jpeg')
6vidTarget= cv2.VideoCapture('F1racecars.mp4')
7
8success, vidTarget = vidTarget.read()
9imgTarget=cv2.resize(imgTarget,(640,360))
10hT, wT, cT = imgTarget.shape
11vidTarget=cv2.resize(vidTarget,(wT,hT))
12
13
14orb = cv2.ORB_create(nfeatures=1000)
15kp1, des1 = orb.detectAndCompute(imgTarget,None)
16
17detect = False
18fcount = 0
19
20
21while True:
22 success, imgWebcam= cap.read()
23 imgAug = imgWebcam.copy()
24
25 imgWarp = np.zeros((imgWebcam.shape[1], imgWebcam.shape[0],imgWebcam.shape[2]))
26 masknew = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1],imgWebcam.shape[2]), np.uint8)
27 maskInv = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1], imgWebcam.shape[2]), np.uint8)
28 Mergecamfeed = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1], imgWebcam.shape[2]), np.uint8)
29 ARfinal = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1], imgWebcam.shape[2]), np.uint8)
30
31 if detect is False:
32 vidTarget.set(cv2.CAP_PROP_POS_FRAMES,0)
33 fcount =0
34 else:
35 if fcount == vidTarget.get(cv2.CAP_PROP_FRAME_COUNT, 0):
36 vidTarget.set(cv2.CAP_PROP_POS_FRAMES, 0)
37 fcount = 0
38 success, vidTarget= vidTarget.read()
39 vidTarget= cv2.resize(vidTarget, (wT, hT))
40
41 kp2, des2 = orb.detectAndCompute(imgWebcam,None)
42
43 if des2 is None: print(False)
44 else:
45 bf = cv2.BFMatcher()
46 featmatch = bf.knnMatch(des1,des2,k=2)
47 good=[]
48 for m,n in featmatch:
49 if m.distance < 0.75 * n.distance: good.append(m)
50 print(len(good))
51
52 if len(good)>20:
53 detect = True
54 srcpts = np.float32([kp1[m.queryIdx].pt for m in good]).reshape(-1, 1, 2)
55 dstpts = np.float32([kp2[m.trainIdx].pt for m in good]).reshape(-1, 1, 2)
56
57 matrix, mask = cv2.findHomography(srcpts,dstpts, cv2.RANSAC, 5)
58 print(matrix)
59
60 pts = np.float32([[0,0],[0,360],[640,360],[640,0]]).reshape(-1, 1, 2)
61
62 dst = cv2.perspectiveTransform(pts,matrix)
63 cv2.polylines(imgWebcam,[np.int32(dst)],True,(255,0,255),3)
64
65 imgWarp = cv2.warpPerspective(vidTarget,matrix, (imgWebcam.shape[1],imgWebcam.shape[0]))
66
67 cv2.fillPoly(masknew, [np.int32(dst)], (255,255,255))
68
69 maskInv = cv2.bitwise_not(masknew)
70
71 Mergecamfeed = cv2.bitwise_and(imgAug,imgAug,None, mask = maskInv[:,:,0])
72
73 ARfinal = cv2.bitwise_or(imgWarp, Mergecamfeed)
74
75
76 cv2.imshow('imgTarget', imgTarget)
77 cv2.imshow('imgTargetVdo', vidTarget)
78 cv2.imshow('webcam', imgWebcam)
79 cv2.imshow('warp', imgWarp)
80 cv2.imshow('mask', masknew)
81 cv2.imshow('Modified mask', maskInv)
82 cv2.imshow('Aug Image', Mergecamfeed)
83 cv2.imshow('Augmented Reality Final O/P', ARfinal)
84 cv2.waitKey(1)
85 fcount += 1
86AttributeError: 'numpy.ndarray' object has no attribute 'set'
87vidTarget.set(cv2.CAP_PROP_POS_FRAMES,0)
88
What's this thing vidTarget
? The error says it's a numpy
array, and is clear that such an object does not have a set
method. Experienced numpy
users also know that. So what kind of object did you expect it to be?
We see attribute errors for one of two reasons. Either the code writer did not read the documentation, and tried to use a non-existent method. Or the variable in question is not what he expected. You should know, at every, step what the variable is - not just guess or hope, know. Test if necessary.
editInitially
1import cv2
2import numpy as np
3
4cap=cv2.VideoCapture(2)
5imgTarget=cv2.imread('F1racecars.jpeg')
6vidTarget= cv2.VideoCapture('F1racecars.mp4')
7
8success, vidTarget = vidTarget.read()
9imgTarget=cv2.resize(imgTarget,(640,360))
10hT, wT, cT = imgTarget.shape
11vidTarget=cv2.resize(vidTarget,(wT,hT))
12
13
14orb = cv2.ORB_create(nfeatures=1000)
15kp1, des1 = orb.detectAndCompute(imgTarget,None)
16
17detect = False
18fcount = 0
19
20
21while True:
22 success, imgWebcam= cap.read()
23 imgAug = imgWebcam.copy()
24
25 imgWarp = np.zeros((imgWebcam.shape[1], imgWebcam.shape[0],imgWebcam.shape[2]))
26 masknew = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1],imgWebcam.shape[2]), np.uint8)
27 maskInv = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1], imgWebcam.shape[2]), np.uint8)
28 Mergecamfeed = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1], imgWebcam.shape[2]), np.uint8)
29 ARfinal = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1], imgWebcam.shape[2]), np.uint8)
30
31 if detect is False:
32 vidTarget.set(cv2.CAP_PROP_POS_FRAMES,0)
33 fcount =0
34 else:
35 if fcount == vidTarget.get(cv2.CAP_PROP_FRAME_COUNT, 0):
36 vidTarget.set(cv2.CAP_PROP_POS_FRAMES, 0)
37 fcount = 0
38 success, vidTarget= vidTarget.read()
39 vidTarget= cv2.resize(vidTarget, (wT, hT))
40
41 kp2, des2 = orb.detectAndCompute(imgWebcam,None)
42
43 if des2 is None: print(False)
44 else:
45 bf = cv2.BFMatcher()
46 featmatch = bf.knnMatch(des1,des2,k=2)
47 good=[]
48 for m,n in featmatch:
49 if m.distance < 0.75 * n.distance: good.append(m)
50 print(len(good))
51
52 if len(good)>20:
53 detect = True
54 srcpts = np.float32([kp1[m.queryIdx].pt for m in good]).reshape(-1, 1, 2)
55 dstpts = np.float32([kp2[m.trainIdx].pt for m in good]).reshape(-1, 1, 2)
56
57 matrix, mask = cv2.findHomography(srcpts,dstpts, cv2.RANSAC, 5)
58 print(matrix)
59
60 pts = np.float32([[0,0],[0,360],[640,360],[640,0]]).reshape(-1, 1, 2)
61
62 dst = cv2.perspectiveTransform(pts,matrix)
63 cv2.polylines(imgWebcam,[np.int32(dst)],True,(255,0,255),3)
64
65 imgWarp = cv2.warpPerspective(vidTarget,matrix, (imgWebcam.shape[1],imgWebcam.shape[0]))
66
67 cv2.fillPoly(masknew, [np.int32(dst)], (255,255,255))
68
69 maskInv = cv2.bitwise_not(masknew)
70
71 Mergecamfeed = cv2.bitwise_and(imgAug,imgAug,None, mask = maskInv[:,:,0])
72
73 ARfinal = cv2.bitwise_or(imgWarp, Mergecamfeed)
74
75
76 cv2.imshow('imgTarget', imgTarget)
77 cv2.imshow('imgTargetVdo', vidTarget)
78 cv2.imshow('webcam', imgWebcam)
79 cv2.imshow('warp', imgWarp)
80 cv2.imshow('mask', masknew)
81 cv2.imshow('Modified mask', maskInv)
82 cv2.imshow('Aug Image', Mergecamfeed)
83 cv2.imshow('Augmented Reality Final O/P', ARfinal)
84 cv2.waitKey(1)
85 fcount += 1
86AttributeError: 'numpy.ndarray' object has no attribute 'set'
87vidTarget.set(cv2.CAP_PROP_POS_FRAMES,0)
88vidTarget= cv2.VideoCapture('F1racecars.mp4')
89
From a quick read of cv2
docs, this has get/set
methods
but then you do
1import cv2
2import numpy as np
3
4cap=cv2.VideoCapture(2)
5imgTarget=cv2.imread('F1racecars.jpeg')
6vidTarget= cv2.VideoCapture('F1racecars.mp4')
7
8success, vidTarget = vidTarget.read()
9imgTarget=cv2.resize(imgTarget,(640,360))
10hT, wT, cT = imgTarget.shape
11vidTarget=cv2.resize(vidTarget,(wT,hT))
12
13
14orb = cv2.ORB_create(nfeatures=1000)
15kp1, des1 = orb.detectAndCompute(imgTarget,None)
16
17detect = False
18fcount = 0
19
20
21while True:
22 success, imgWebcam= cap.read()
23 imgAug = imgWebcam.copy()
24
25 imgWarp = np.zeros((imgWebcam.shape[1], imgWebcam.shape[0],imgWebcam.shape[2]))
26 masknew = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1],imgWebcam.shape[2]), np.uint8)
27 maskInv = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1], imgWebcam.shape[2]), np.uint8)
28 Mergecamfeed = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1], imgWebcam.shape[2]), np.uint8)
29 ARfinal = np.zeros((imgWebcam.shape[0], imgWebcam.shape[1], imgWebcam.shape[2]), np.uint8)
30
31 if detect is False:
32 vidTarget.set(cv2.CAP_PROP_POS_FRAMES,0)
33 fcount =0
34 else:
35 if fcount == vidTarget.get(cv2.CAP_PROP_FRAME_COUNT, 0):
36 vidTarget.set(cv2.CAP_PROP_POS_FRAMES, 0)
37 fcount = 0
38 success, vidTarget= vidTarget.read()
39 vidTarget= cv2.resize(vidTarget, (wT, hT))
40
41 kp2, des2 = orb.detectAndCompute(imgWebcam,None)
42
43 if des2 is None: print(False)
44 else:
45 bf = cv2.BFMatcher()
46 featmatch = bf.knnMatch(des1,des2,k=2)
47 good=[]
48 for m,n in featmatch:
49 if m.distance < 0.75 * n.distance: good.append(m)
50 print(len(good))
51
52 if len(good)>20:
53 detect = True
54 srcpts = np.float32([kp1[m.queryIdx].pt for m in good]).reshape(-1, 1, 2)
55 dstpts = np.float32([kp2[m.trainIdx].pt for m in good]).reshape(-1, 1, 2)
56
57 matrix, mask = cv2.findHomography(srcpts,dstpts, cv2.RANSAC, 5)
58 print(matrix)
59
60 pts = np.float32([[0,0],[0,360],[640,360],[640,0]]).reshape(-1, 1, 2)
61
62 dst = cv2.perspectiveTransform(pts,matrix)
63 cv2.polylines(imgWebcam,[np.int32(dst)],True,(255,0,255),3)
64
65 imgWarp = cv2.warpPerspective(vidTarget,matrix, (imgWebcam.shape[1],imgWebcam.shape[0]))
66
67 cv2.fillPoly(masknew, [np.int32(dst)], (255,255,255))
68
69 maskInv = cv2.bitwise_not(masknew)
70
71 Mergecamfeed = cv2.bitwise_and(imgAug,imgAug,None, mask = maskInv[:,:,0])
72
73 ARfinal = cv2.bitwise_or(imgWarp, Mergecamfeed)
74
75
76 cv2.imshow('imgTarget', imgTarget)
77 cv2.imshow('imgTargetVdo', vidTarget)
78 cv2.imshow('webcam', imgWebcam)
79 cv2.imshow('warp', imgWarp)
80 cv2.imshow('mask', masknew)
81 cv2.imshow('Modified mask', maskInv)
82 cv2.imshow('Aug Image', Mergecamfeed)
83 cv2.imshow('Augmented Reality Final O/P', ARfinal)
84 cv2.waitKey(1)
85 fcount += 1
86AttributeError: 'numpy.ndarray' object has no attribute 'set'
87vidTarget.set(cv2.CAP_PROP_POS_FRAMES,0)
88vidTarget= cv2.VideoCapture('F1racecars.mp4')
89succses, vidTarget = vidTarget.read()
90# and resize
91
That redefines vidTarget
.
QUESTION
Move the centre of the force within Reality Composer scene
Asked 2022-Feb-05 at 10:59Based on the Apples custom behaviour documentation I am able to trigger addForce
for my Entity
and modify the velocity of the force and also the angle where it is applied. The only problem I am facing that I would like to apply the force on the certain area of my object not always on the center.
I can get the point where the user tapped my object, but with notifying the addForce it always triggers the force application for the centre of my object. Like this the object behaves weird and I lost the immersion of the augmented reality, is there a way to modify the point where the force is applied?
ANSWER
Answered 2022-Feb-05 at 10:59Physics forces are applied to the model's pivot position. At the moment, neither RealityKit nor Reality Composer has the ability to change the location of an object's pivot point.
In addition to the above, you've applied Add Force
behavior that pushes an object along a specific vector with the definite velocity, however, user's taps occur along the local -Z axis of the screen. Do these vectors match?
And one more note: within the Reality-family, only rigid body dynamics is possible, not soft body.
QUESTION
How do I include rows from dataframe that contain certain keywords
Asked 2022-Feb-04 at 15:47I'm analysing reddit threads for an assignment and I only want to include threads that contain certain keywords.
I have a list of keywords: keywords <- c(addict', 'addicted', 'addiction','addictive', 'afraid' ,'anxiety','anxious','cry','crying','delusion','delusional')
The dataframe has 3 columns. I want to only include rows that contain one of the keywords in the column called title.
e.g.
title | created_utc | |
---|---|---|
1 | Anyone have a RH wallet yet? Asking for a friend | 164128421 |
2 | Ravi Menon, managing director of the Monetary Auth... | 164131283 |
3 | Different Augmented Reality(AR) NFT apps and marke... | 164134123 |
keywordstest2<-paste0(keywords, collapse = "|")
dfsub%>% filter(grepl(keywordstest2,title))
Tried this, obvs didn't work.
Does anyone know how to do this. Thanks :D
ANSWER
Answered 2022-Feb-04 at 04:13This should work.
1dfsub %>% filter(grepl('addict|addicted|addiction|addictive|afraid|anxiety|anxious|cry|crying|delusion|delusional', title))
2
QUESTION
Jquery .resizable function - resize icon not displaying properly
Asked 2022-Jan-26 at 01:30New to coding and doing an interview challenge.
They've asked for a dashboard made from JQuery (which I've never used before). Lots of help from W3schools and here in stack has me accomplished 100% of the functionality I need (even if the design could be improved: functionality first polish later!)
One of the bonus is to have some UI /UX functionality, so I've made the divs dragable, and I added the snip below from https://jqueryui.com/resizable/ to make the divs resizable.
1$(function()){
2$( "resizable" ).resizable();
3});
4
But when it runs, the little resize icon seems to do something different from the example on the page above.
Are there any ideas how I can fix it back into the resize icon, the way it is supposed to look?
1$(function()){
2$( "resizable" ).resizable();
3});
4var $linkID, $linkURL
5
6function changeTime(){
7 let d= new Date(); //built in JS function
8 let mm = ('0' + d.getMinutes()).slice(-2);
9 let ss = ('0' + d.getSeconds()).slice(-2);
10 document.getElementById("dateTime").innerHTML = `${d.getMonth()}/${d.getDay()}/${d.getYear()} ${d.getHours()}:${mm}:${ss}`;
11}
12
13setInterval(changeTime, 1000); //updates the time dynamically.
14
15//Group1
16//Click to Show functionality: group 1
17//clicks hide all divs, then uses a "title" attribute as a variable to toggle the associated box showing that title's information.
18//I am no marketer, so the text is some basic info I read on the websites.
19$(document).ready(function(){
20 $(".clickToShow").click(function(){
21 $(".clickToShowBlock").hide();
22 let idTag = '#' + this.getAttribute("title");
23 $(idTag).toggle();
24 });
25 });
26
27//Group 2
28//Same as above, except using hover instead of click to show the images.
29
30$(document).ready(function(){
31 $(".hoverToShow").hover(function(){let idTag = '#' + this.getAttribute("title");
32 $(idTag).show();
33 }, function(){let idTag = '#' + this.getAttribute("title");
34 $(idTag).hide();
35 $(".hoverToShowBlock").hide();
36 });
37 });
38
39 //Group3
40 //follows group 1 method, but loads all links at the same time by toggling a button.
41
42$(document).ready(function(){
43 $("#showLinksButton").click(function(){
44 $(".showLinks").toggle();
45 });
46 });
47
48 $(function(){
49 $("#showLinksButton").click(function () {
50 $(this).text(function(i, text){
51 return text === "Show Links" ? "Hide Links" : "Show Links";
52 })
53 });
54 })
55 //https://stackoverflow.com/questions/13652835/button-text-toggle-in-jquery
56
57 //Group4
58 //https://stackoverflow.com/questions/4511652/looping-through-list-items-with-jquery
59// http://jsfiddle.net/mblase75/wE4S8/
60//from: https://stackoverflow.com/questions/20105762/show-n-number-of-list-elements-at-a-time-jquery
61$(document).ready(function (){
62 var elements =$("#aviationLinks li");
63 var index=0;
64 var showTwo = function (index) {
65 if (index >=elements.length){
66 index = 0
67 }
68 elements.hide().slice(index, index+2).show();
69 setTimeout(function(){
70 showTwo(index +2)
71 }, 5000);
72 }
73 showTwo(0);
74 });
75
76//Make key-value pairs on id and hyperlinks
77const linkIDref = {
78 delphiInfo:"https://delphitechcorp.com/",
79 vrCityInfo:"https://vrcity.ca/",
80 auroraInfo:"https://auroraaerial.aero",
81 virbelaURL:"https://virbela.com",
82 amazonURL:"https://amazon.com",
83 moodleURL:"https://moodle.org",
84 xPlaneURL:"https://x-plane.com",
85 wordpressURL:"https://wordpress.org",
86 gitHub:"https://github.com",
87 googleMeet:"https://meet.google.com",
88 slack:"https://slack.com",
89 wrike:"https://wrike.com",
90 airbus:"https://airbus.com",
91 boeing:"https://boeing.com",
92 lockheedMartin:"https://lockheedmartin.com",
93 rtx:"https://rtx.com",
94 geAviation:"https://geaviation.com",
95 safran:"https://safran-group.com",
96 leonardo:"https://leonardocompany.com",
97 baseSystems:"https://baesystems.com"
98}
99//use key-values to populate the dynamic hyperlink functionality.
100jQuery(".link").click(function(){
101 $linkID = $(this).attr("id");
102 window.location.href=linkIDref[$linkID];
103})
104
105$( function() {
106 $( ".groups" ).draggable();
107 } );
108
109 $( function() {
110 $( ".groups" ).resizable();
111 } );
1$(function()){
2$( "resizable" ).resizable();
3});
4var $linkID, $linkURL
5
6function changeTime(){
7 let d= new Date(); //built in JS function
8 let mm = ('0' + d.getMinutes()).slice(-2);
9 let ss = ('0' + d.getSeconds()).slice(-2);
10 document.getElementById("dateTime").innerHTML = `${d.getMonth()}/${d.getDay()}/${d.getYear()} ${d.getHours()}:${mm}:${ss}`;
11}
12
13setInterval(changeTime, 1000); //updates the time dynamically.
14
15//Group1
16//Click to Show functionality: group 1
17//clicks hide all divs, then uses a "title" attribute as a variable to toggle the associated box showing that title's information.
18//I am no marketer, so the text is some basic info I read on the websites.
19$(document).ready(function(){
20 $(".clickToShow").click(function(){
21 $(".clickToShowBlock").hide();
22 let idTag = '#' + this.getAttribute("title");
23 $(idTag).toggle();
24 });
25 });
26
27//Group 2
28//Same as above, except using hover instead of click to show the images.
29
30$(document).ready(function(){
31 $(".hoverToShow").hover(function(){let idTag = '#' + this.getAttribute("title");
32 $(idTag).show();
33 }, function(){let idTag = '#' + this.getAttribute("title");
34 $(idTag).hide();
35 $(".hoverToShowBlock").hide();
36 });
37 });
38
39 //Group3
40 //follows group 1 method, but loads all links at the same time by toggling a button.
41
42$(document).ready(function(){
43 $("#showLinksButton").click(function(){
44 $(".showLinks").toggle();
45 });
46 });
47
48 $(function(){
49 $("#showLinksButton").click(function () {
50 $(this).text(function(i, text){
51 return text === "Show Links" ? "Hide Links" : "Show Links";
52 })
53 });
54 })
55 //https://stackoverflow.com/questions/13652835/button-text-toggle-in-jquery
56
57 //Group4
58 //https://stackoverflow.com/questions/4511652/looping-through-list-items-with-jquery
59// http://jsfiddle.net/mblase75/wE4S8/
60//from: https://stackoverflow.com/questions/20105762/show-n-number-of-list-elements-at-a-time-jquery
61$(document).ready(function (){
62 var elements =$("#aviationLinks li");
63 var index=0;
64 var showTwo = function (index) {
65 if (index >=elements.length){
66 index = 0
67 }
68 elements.hide().slice(index, index+2).show();
69 setTimeout(function(){
70 showTwo(index +2)
71 }, 5000);
72 }
73 showTwo(0);
74 });
75
76//Make key-value pairs on id and hyperlinks
77const linkIDref = {
78 delphiInfo:"https://delphitechcorp.com/",
79 vrCityInfo:"https://vrcity.ca/",
80 auroraInfo:"https://auroraaerial.aero",
81 virbelaURL:"https://virbela.com",
82 amazonURL:"https://amazon.com",
83 moodleURL:"https://moodle.org",
84 xPlaneURL:"https://x-plane.com",
85 wordpressURL:"https://wordpress.org",
86 gitHub:"https://github.com",
87 googleMeet:"https://meet.google.com",
88 slack:"https://slack.com",
89 wrike:"https://wrike.com",
90 airbus:"https://airbus.com",
91 boeing:"https://boeing.com",
92 lockheedMartin:"https://lockheedmartin.com",
93 rtx:"https://rtx.com",
94 geAviation:"https://geaviation.com",
95 safran:"https://safran-group.com",
96 leonardo:"https://leonardocompany.com",
97 baseSystems:"https://baesystems.com"
98}
99//use key-values to populate the dynamic hyperlink functionality.
100jQuery(".link").click(function(){
101 $linkID = $(this).attr("id");
102 window.location.href=linkIDref[$linkID];
103})
104
105$( function() {
106 $( ".groups" ).draggable();
107 } );
108
109 $( function() {
110 $( ".groups" ).resizable();
111 } );body{
112 font-family: Arial, Helvetica, sans-serif;
113 font-size:1em;
114 background-color: skyblue;
115}
116h1{
117 text-align:center;
118}
119div{
120 border: black solid 2px;
121 border-radius:10px;
122}
123#main{
124 width:100%;
125 height: fit-content;
126 border:none;
127}
128#dashboard{
129 margin:auto auto auto auto;
130 display:grid;
131 border:none;
132 grid-template-columns: auto auto;
133 column-gap: 1em;
134 row-gap: 1em;
135 width:100%;
136 height:fit-content;
137}
138#dateTime{
139 margin:1em auto 1em auto;
140 border: black solid 2px;
141 width:fit-content;
142 height:fit-content;
143 padding:1em;
144 font-size: larger;
145 font-weight: bolder;
146 background-color: snow;
147}
148.groups{
149 position: relative;
150 margin:auto auto auto auto;
151 width:35em;
152 min-width: 32.5em;
153 background-color: snow;
154 padding:0px;
155 overflow: hidden;
156}
157.groups h2{
158 position:relative;
159 top:-0.9em;
160 text-align:center;
161 background-color: blue;
162 color:white;
163 cursor:move;
164}
165ul{
166 list-style-type: none;
167 position:relative;
168 top:-0.5em;
169}
170#group1{
171 height:10em;
172}
173#group2{
174 height:10em;
175}
176.clickToShowBlock{
177 cursor:pointer;
178 display:none;
179 position:absolute;
180 top: 3.5em;
181 left:12em;
182 height:fit-content;
183 width:20em;
184 border:none;
185}
186.hoverToShowBlock{
187 display:none;
188 position:absolute;
189 top: 4em;
190 left:12em;
191 height:fit-content;
192 width:20em;
193 border:none;
194}
195.hoverToShowBlock img{
196 max-height:6em;
197 max-width:19em;
198}
199dd{
200 padding: 0.5em 0em 0.5em 0em;
201}
202.showLinks{
203 display:none;
204}
205#showLinksButton{
206 position:absolute;
207 right:0.5em;
208 top:2em;
209 font-size:2em;
210}
211li:hover{
212 cursor:pointer;
213}
214
215dd:hover{
216 cursor:pointer;
217}
218@media screen and (max-width: 1200px)
219{
220 #dashboard{
221
222 grid-template-columns: auto;
223 }
224}
1$(function()){
2$( "resizable" ).resizable();
3});
4var $linkID, $linkURL
5
6function changeTime(){
7 let d= new Date(); //built in JS function
8 let mm = ('0' + d.getMinutes()).slice(-2);
9 let ss = ('0' + d.getSeconds()).slice(-2);
10 document.getElementById("dateTime").innerHTML = `${d.getMonth()}/${d.getDay()}/${d.getYear()} ${d.getHours()}:${mm}:${ss}`;
11}
12
13setInterval(changeTime, 1000); //updates the time dynamically.
14
15//Group1
16//Click to Show functionality: group 1
17//clicks hide all divs, then uses a "title" attribute as a variable to toggle the associated box showing that title's information.
18//I am no marketer, so the text is some basic info I read on the websites.
19$(document).ready(function(){
20 $(".clickToShow").click(function(){
21 $(".clickToShowBlock").hide();
22 let idTag = '#' + this.getAttribute("title");
23 $(idTag).toggle();
24 });
25 });
26
27//Group 2
28//Same as above, except using hover instead of click to show the images.
29
30$(document).ready(function(){
31 $(".hoverToShow").hover(function(){let idTag = '#' + this.getAttribute("title");
32 $(idTag).show();
33 }, function(){let idTag = '#' + this.getAttribute("title");
34 $(idTag).hide();
35 $(".hoverToShowBlock").hide();
36 });
37 });
38
39 //Group3
40 //follows group 1 method, but loads all links at the same time by toggling a button.
41
42$(document).ready(function(){
43 $("#showLinksButton").click(function(){
44 $(".showLinks").toggle();
45 });
46 });
47
48 $(function(){
49 $("#showLinksButton").click(function () {
50 $(this).text(function(i, text){
51 return text === "Show Links" ? "Hide Links" : "Show Links";
52 })
53 });
54 })
55 //https://stackoverflow.com/questions/13652835/button-text-toggle-in-jquery
56
57 //Group4
58 //https://stackoverflow.com/questions/4511652/looping-through-list-items-with-jquery
59// http://jsfiddle.net/mblase75/wE4S8/
60//from: https://stackoverflow.com/questions/20105762/show-n-number-of-list-elements-at-a-time-jquery
61$(document).ready(function (){
62 var elements =$("#aviationLinks li");
63 var index=0;
64 var showTwo = function (index) {
65 if (index >=elements.length){
66 index = 0
67 }
68 elements.hide().slice(index, index+2).show();
69 setTimeout(function(){
70 showTwo(index +2)
71 }, 5000);
72 }
73 showTwo(0);
74 });
75
76//Make key-value pairs on id and hyperlinks
77const linkIDref = {
78 delphiInfo:"https://delphitechcorp.com/",
79 vrCityInfo:"https://vrcity.ca/",
80 auroraInfo:"https://auroraaerial.aero",
81 virbelaURL:"https://virbela.com",
82 amazonURL:"https://amazon.com",
83 moodleURL:"https://moodle.org",
84 xPlaneURL:"https://x-plane.com",
85 wordpressURL:"https://wordpress.org",
86 gitHub:"https://github.com",
87 googleMeet:"https://meet.google.com",
88 slack:"https://slack.com",
89 wrike:"https://wrike.com",
90 airbus:"https://airbus.com",
91 boeing:"https://boeing.com",
92 lockheedMartin:"https://lockheedmartin.com",
93 rtx:"https://rtx.com",
94 geAviation:"https://geaviation.com",
95 safran:"https://safran-group.com",
96 leonardo:"https://leonardocompany.com",
97 baseSystems:"https://baesystems.com"
98}
99//use key-values to populate the dynamic hyperlink functionality.
100jQuery(".link").click(function(){
101 $linkID = $(this).attr("id");
102 window.location.href=linkIDref[$linkID];
103})
104
105$( function() {
106 $( ".groups" ).draggable();
107 } );
108
109 $( function() {
110 $( ".groups" ).resizable();
111 } );body{
112 font-family: Arial, Helvetica, sans-serif;
113 font-size:1em;
114 background-color: skyblue;
115}
116h1{
117 text-align:center;
118}
119div{
120 border: black solid 2px;
121 border-radius:10px;
122}
123#main{
124 width:100%;
125 height: fit-content;
126 border:none;
127}
128#dashboard{
129 margin:auto auto auto auto;
130 display:grid;
131 border:none;
132 grid-template-columns: auto auto;
133 column-gap: 1em;
134 row-gap: 1em;
135 width:100%;
136 height:fit-content;
137}
138#dateTime{
139 margin:1em auto 1em auto;
140 border: black solid 2px;
141 width:fit-content;
142 height:fit-content;
143 padding:1em;
144 font-size: larger;
145 font-weight: bolder;
146 background-color: snow;
147}
148.groups{
149 position: relative;
150 margin:auto auto auto auto;
151 width:35em;
152 min-width: 32.5em;
153 background-color: snow;
154 padding:0px;
155 overflow: hidden;
156}
157.groups h2{
158 position:relative;
159 top:-0.9em;
160 text-align:center;
161 background-color: blue;
162 color:white;
163 cursor:move;
164}
165ul{
166 list-style-type: none;
167 position:relative;
168 top:-0.5em;
169}
170#group1{
171 height:10em;
172}
173#group2{
174 height:10em;
175}
176.clickToShowBlock{
177 cursor:pointer;
178 display:none;
179 position:absolute;
180 top: 3.5em;
181 left:12em;
182 height:fit-content;
183 width:20em;
184 border:none;
185}
186.hoverToShowBlock{
187 display:none;
188 position:absolute;
189 top: 4em;
190 left:12em;
191 height:fit-content;
192 width:20em;
193 border:none;
194}
195.hoverToShowBlock img{
196 max-height:6em;
197 max-width:19em;
198}
199dd{
200 padding: 0.5em 0em 0.5em 0em;
201}
202.showLinks{
203 display:none;
204}
205#showLinksButton{
206 position:absolute;
207 right:0.5em;
208 top:2em;
209 font-size:2em;
210}
211li:hover{
212 cursor:pointer;
213}
214
215dd:hover{
216 cursor:pointer;
217}
218@media screen and (max-width: 1200px)
219{
220 #dashboard{
221
222 grid-template-columns: auto;
223 }
224}<!DOCTYPE html>
225<html lang="en">
226 <head>
227 <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
228 <script src="https://code.jquery.com/ui/1.13.0/jquery-ui.js"></script>
229 <link rel="stylesheet" href="stylesheet2.css">
230 <meta charset="UTF-8" />
231 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
232 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
233 <title>Delphi Tech Corp Front-End Development Team Coding Test</title>
234 <script src="script2.js" defer></script>
235 </head>
236 <body>
237 <h1>TASK 2 Dashboard</h1>
238 <div id="main">
239 <div id = "dateTime"></div>
240 <div id = "dashboard">
241 <div id="group1" class = "groups">
242 <h2 id="group1h2">Group 1 - Alan Zheng's Companys + Products</h2>
243 <ul>
244 <li class="clickToShow" title = "vrCityInfo">VR City</li>
245 <li class="clickToShow" title = "delphiInfo">Delphi Tech Corp</li>
246 <li class="clickToShow" title = "auroraInfo">Aurora Aerial</li>
247 </ul>
248 <div id="vrCityInfo" class="clickToShowBlock link">
249 VR City is a virtual aviation training company. Our virtual community provides people with the learning tools to learn how to fly.
250 <br>
251 https://vrcity.ca/
252 </div>
253 <div id="delphiInfo" class="clickToShowBlock link">
254 Delphi Technology Corp is integrating new technologies such as augmented reality and virtuality into the aerospace and aviation industries!
255 <br>
256 https://delphitechcorp.com/
257 </div>
258 <div id="auroraInfo" class="clickToShowBlock link">
259 Aurora Aerial offers custom drone manufacturing. We develop both drone hardware and software.
260 <br>
261 https://auroraaerial.aero
262 </div>
263
264 </div>
265 <div id="group2" class = "groups">
266 <h2 id="group2h2">Group 2 - Technology products used at Delphi</h2>
267 <ul>
268 <li class="hoverToShow link" title= "virbela" id= "virbelaURL">Virbela</li>
269 <li class="hoverToShow link" title= "amazon" id= "amazonURL">Amazon</li>
270 <li class="hoverToShow link" title= "moodle" id= "moodleURL">Moodle</li>
271 <li class="hoverToShow link" title= "xPlane" id= "xPlaneURL">X-Plane</li>
272 <li class="hoverToShow link" title= "wordpress" id= "wordpressURL">Wordpress</li>
273 </ul>
274
275 <div id="virbela" class="hoverToShowBlock">
276 <img alt="Virbela" src="Logos/5fab9393da4ffe1e20d14cc6_virbela-logo-black-website.png">
277 </div>
278 <div id="amazon" class="hoverToShowBlock">
279 <img alt="Amazon" src="Logos/NicePng_amazon-png_197561.png">
280 </div>
281 <div id="moodle" class="hoverToShowBlock">
282 <img alt="Moodle" src="Logos/moodle_logo_small.svg">
283 </div>
284 <div id="xPlane" class="hoverToShowBlock">
285 <img alt="X-Plane" src="Logos/x-plane-logo.svg">
286 </div>
287 <div id="wordpress" class="hoverToShowBlock">
288 <img alt="Virbela" src="Logos/NicePng_wordpress-logo-png_395752.png">
289 </div>
290
291 </div>
292 <div id="group3" class = "groups">
293 <h2 id="group3h2">Group 3 - Websites used at Delphi</h2>
294 <ul>
295 <dt>GitHub</dt>
296 <dd class="showLinks link" id="gitHub">https://github.com</dd>
297 <dt>Google Meet</dt>
298 <dd class="showLinks link" id="googleMeet">https://meet.google.com</dd>
299 <dt>Slack</dt>
300 <dd class="showLinks link" id="slack">https://slack.com</dd>
301 <dt>Wrike</dt>
302 <dd class="showLinks link" id="wrike">https://wrike.com</dd>
303 </ul>
304 <button id="showLinksButton">Show Links</button>
305 </div>
306 <div id="group4" class = "groups">
307 <h2 id="group4h2">Group 4 - Aerospace Companies</h2>
308
309 <ul id="aviationLinks">
310 <li class = "cycle link" id="airbus">airbus.com</li>
311 <li class = "cycle link" id="boeing">boeing.com</li>
312 <li class = "cycle link" id="lockheedMartin">lockheedmartin.com</li>
313 <li class = "cycle link" id="rtx">rtx.com</li>
314 <li class = "cycle link" id="geAviation">geaviation.com</li>
315 <li class = "cycle link" id="safran">safran-group.com</li>
316 <li class = "cycle link" id="leonardo">leonardocompany.com</li>
317 <li class = "cycle link" id="baseSystems">baesystems.com</li>
318 </ul>
319 </div>
320 </div>
321 </div>
322 </body>
323</html>
ANSWER
Answered 2021-Dec-18 at 21:46You simply did not use the jQuery-ui CSS file...
1$(function()){
2$( "resizable" ).resizable();
3});
4var $linkID, $linkURL
5
6function changeTime(){
7 let d= new Date(); //built in JS function
8 let mm = ('0' + d.getMinutes()).slice(-2);
9 let ss = ('0' + d.getSeconds()).slice(-2);
10 document.getElementById("dateTime").innerHTML = `${d.getMonth()}/${d.getDay()}/${d.getYear()} ${d.getHours()}:${mm}:${ss}`;
11}
12
13setInterval(changeTime, 1000); //updates the time dynamically.
14
15//Group1
16//Click to Show functionality: group 1
17//clicks hide all divs, then uses a "title" attribute as a variable to toggle the associated box showing that title's information.
18//I am no marketer, so the text is some basic info I read on the websites.
19$(document).ready(function(){
20 $(".clickToShow").click(function(){
21 $(".clickToShowBlock").hide();
22 let idTag = '#' + this.getAttribute("title");
23 $(idTag).toggle();
24 });
25 });
26
27//Group 2
28//Same as above, except using hover instead of click to show the images.
29
30$(document).ready(function(){
31 $(".hoverToShow").hover(function(){let idTag = '#' + this.getAttribute("title");
32 $(idTag).show();
33 }, function(){let idTag = '#' + this.getAttribute("title");
34 $(idTag).hide();
35 $(".hoverToShowBlock").hide();
36 });
37 });
38
39 //Group3
40 //follows group 1 method, but loads all links at the same time by toggling a button.
41
42$(document).ready(function(){
43 $("#showLinksButton").click(function(){
44 $(".showLinks").toggle();
45 });
46 });
47
48 $(function(){
49 $("#showLinksButton").click(function () {
50 $(this).text(function(i, text){
51 return text === "Show Links" ? "Hide Links" : "Show Links";
52 })
53 });
54 })
55 //https://stackoverflow.com/questions/13652835/button-text-toggle-in-jquery
56
57 //Group4
58 //https://stackoverflow.com/questions/4511652/looping-through-list-items-with-jquery
59// http://jsfiddle.net/mblase75/wE4S8/
60//from: https://stackoverflow.com/questions/20105762/show-n-number-of-list-elements-at-a-time-jquery
61$(document).ready(function (){
62 var elements =$("#aviationLinks li");
63 var index=0;
64 var showTwo = function (index) {
65 if (index >=elements.length){
66 index = 0
67 }
68 elements.hide().slice(index, index+2).show();
69 setTimeout(function(){
70 showTwo(index +2)
71 }, 5000);
72 }
73 showTwo(0);
74 });
75
76//Make key-value pairs on id and hyperlinks
77const linkIDref = {
78 delphiInfo:"https://delphitechcorp.com/",
79 vrCityInfo:"https://vrcity.ca/",
80 auroraInfo:"https://auroraaerial.aero",
81 virbelaURL:"https://virbela.com",
82 amazonURL:"https://amazon.com",
83 moodleURL:"https://moodle.org",
84 xPlaneURL:"https://x-plane.com",
85 wordpressURL:"https://wordpress.org",
86 gitHub:"https://github.com",
87 googleMeet:"https://meet.google.com",
88 slack:"https://slack.com",
89 wrike:"https://wrike.com",
90 airbus:"https://airbus.com",
91 boeing:"https://boeing.com",
92 lockheedMartin:"https://lockheedmartin.com",
93 rtx:"https://rtx.com",
94 geAviation:"https://geaviation.com",
95 safran:"https://safran-group.com",
96 leonardo:"https://leonardocompany.com",
97 baseSystems:"https://baesystems.com"
98}
99//use key-values to populate the dynamic hyperlink functionality.
100jQuery(".link").click(function(){
101 $linkID = $(this).attr("id");
102 window.location.href=linkIDref[$linkID];
103})
104
105$( function() {
106 $( ".groups" ).draggable();
107 } );
108
109 $( function() {
110 $( ".groups" ).resizable();
111 } );body{
112 font-family: Arial, Helvetica, sans-serif;
113 font-size:1em;
114 background-color: skyblue;
115}
116h1{
117 text-align:center;
118}
119div{
120 border: black solid 2px;
121 border-radius:10px;
122}
123#main{
124 width:100%;
125 height: fit-content;
126 border:none;
127}
128#dashboard{
129 margin:auto auto auto auto;
130 display:grid;
131 border:none;
132 grid-template-columns: auto auto;
133 column-gap: 1em;
134 row-gap: 1em;
135 width:100%;
136 height:fit-content;
137}
138#dateTime{
139 margin:1em auto 1em auto;
140 border: black solid 2px;
141 width:fit-content;
142 height:fit-content;
143 padding:1em;
144 font-size: larger;
145 font-weight: bolder;
146 background-color: snow;
147}
148.groups{
149 position: relative;
150 margin:auto auto auto auto;
151 width:35em;
152 min-width: 32.5em;
153 background-color: snow;
154 padding:0px;
155 overflow: hidden;
156}
157.groups h2{
158 position:relative;
159 top:-0.9em;
160 text-align:center;
161 background-color: blue;
162 color:white;
163 cursor:move;
164}
165ul{
166 list-style-type: none;
167 position:relative;
168 top:-0.5em;
169}
170#group1{
171 height:10em;
172}
173#group2{
174 height:10em;
175}
176.clickToShowBlock{
177 cursor:pointer;
178 display:none;
179 position:absolute;
180 top: 3.5em;
181 left:12em;
182 height:fit-content;
183 width:20em;
184 border:none;
185}
186.hoverToShowBlock{
187 display:none;
188 position:absolute;
189 top: 4em;
190 left:12em;
191 height:fit-content;
192 width:20em;
193 border:none;
194}
195.hoverToShowBlock img{
196 max-height:6em;
197 max-width:19em;
198}
199dd{
200 padding: 0.5em 0em 0.5em 0em;
201}
202.showLinks{
203 display:none;
204}
205#showLinksButton{
206 position:absolute;
207 right:0.5em;
208 top:2em;
209 font-size:2em;
210}
211li:hover{
212 cursor:pointer;
213}
214
215dd:hover{
216 cursor:pointer;
217}
218@media screen and (max-width: 1200px)
219{
220 #dashboard{
221
222 grid-template-columns: auto;
223 }
224}<!DOCTYPE html>
225<html lang="en">
226 <head>
227 <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
228 <script src="https://code.jquery.com/ui/1.13.0/jquery-ui.js"></script>
229 <link rel="stylesheet" href="stylesheet2.css">
230 <meta charset="UTF-8" />
231 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
232 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
233 <title>Delphi Tech Corp Front-End Development Team Coding Test</title>
234 <script src="script2.js" defer></script>
235 </head>
236 <body>
237 <h1>TASK 2 Dashboard</h1>
238 <div id="main">
239 <div id = "dateTime"></div>
240 <div id = "dashboard">
241 <div id="group1" class = "groups">
242 <h2 id="group1h2">Group 1 - Alan Zheng's Companys + Products</h2>
243 <ul>
244 <li class="clickToShow" title = "vrCityInfo">VR City</li>
245 <li class="clickToShow" title = "delphiInfo">Delphi Tech Corp</li>
246 <li class="clickToShow" title = "auroraInfo">Aurora Aerial</li>
247 </ul>
248 <div id="vrCityInfo" class="clickToShowBlock link">
249 VR City is a virtual aviation training company. Our virtual community provides people with the learning tools to learn how to fly.
250 <br>
251 https://vrcity.ca/
252 </div>
253 <div id="delphiInfo" class="clickToShowBlock link">
254 Delphi Technology Corp is integrating new technologies such as augmented reality and virtuality into the aerospace and aviation industries!
255 <br>
256 https://delphitechcorp.com/
257 </div>
258 <div id="auroraInfo" class="clickToShowBlock link">
259 Aurora Aerial offers custom drone manufacturing. We develop both drone hardware and software.
260 <br>
261 https://auroraaerial.aero
262 </div>
263
264 </div>
265 <div id="group2" class = "groups">
266 <h2 id="group2h2">Group 2 - Technology products used at Delphi</h2>
267 <ul>
268 <li class="hoverToShow link" title= "virbela" id= "virbelaURL">Virbela</li>
269 <li class="hoverToShow link" title= "amazon" id= "amazonURL">Amazon</li>
270 <li class="hoverToShow link" title= "moodle" id= "moodleURL">Moodle</li>
271 <li class="hoverToShow link" title= "xPlane" id= "xPlaneURL">X-Plane</li>
272 <li class="hoverToShow link" title= "wordpress" id= "wordpressURL">Wordpress</li>
273 </ul>
274
275 <div id="virbela" class="hoverToShowBlock">
276 <img alt="Virbela" src="Logos/5fab9393da4ffe1e20d14cc6_virbela-logo-black-website.png">
277 </div>
278 <div id="amazon" class="hoverToShowBlock">
279 <img alt="Amazon" src="Logos/NicePng_amazon-png_197561.png">
280 </div>
281 <div id="moodle" class="hoverToShowBlock">
282 <img alt="Moodle" src="Logos/moodle_logo_small.svg">
283 </div>
284 <div id="xPlane" class="hoverToShowBlock">
285 <img alt="X-Plane" src="Logos/x-plane-logo.svg">
286 </div>
287 <div id="wordpress" class="hoverToShowBlock">
288 <img alt="Virbela" src="Logos/NicePng_wordpress-logo-png_395752.png">
289 </div>
290
291 </div>
292 <div id="group3" class = "groups">
293 <h2 id="group3h2">Group 3 - Websites used at Delphi</h2>
294 <ul>
295 <dt>GitHub</dt>
296 <dd class="showLinks link" id="gitHub">https://github.com</dd>
297 <dt>Google Meet</dt>
298 <dd class="showLinks link" id="googleMeet">https://meet.google.com</dd>
299 <dt>Slack</dt>
300 <dd class="showLinks link" id="slack">https://slack.com</dd>
301 <dt>Wrike</dt>
302 <dd class="showLinks link" id="wrike">https://wrike.com</dd>
303 </ul>
304 <button id="showLinksButton">Show Links</button>
305 </div>
306 <div id="group4" class = "groups">
307 <h2 id="group4h2">Group 4 - Aerospace Companies</h2>
308
309 <ul id="aviationLinks">
310 <li class = "cycle link" id="airbus">airbus.com</li>
311 <li class = "cycle link" id="boeing">boeing.com</li>
312 <li class = "cycle link" id="lockheedMartin">lockheedmartin.com</li>
313 <li class = "cycle link" id="rtx">rtx.com</li>
314 <li class = "cycle link" id="geAviation">geaviation.com</li>
315 <li class = "cycle link" id="safran">safran-group.com</li>
316 <li class = "cycle link" id="leonardo">leonardocompany.com</li>
317 <li class = "cycle link" id="baseSystems">baesystems.com</li>
318 </ul>
319 </div>
320 </div>
321 </div>
322 </body>
323</html><link rel="stylesheet" href="//code.jquery.com/ui/1.13.0/themes/base/jquery-ui.css">
324
And you have a way too "wide" rule on div
. So specific to the rezise handles, it needed an exception using the :not()
selector.
1$(function()){
2$( "resizable" ).resizable();
3});
4var $linkID, $linkURL
5
6function changeTime(){
7 let d= new Date(); //built in JS function
8 let mm = ('0' + d.getMinutes()).slice(-2);
9 let ss = ('0' + d.getSeconds()).slice(-2);
10 document.getElementById("dateTime").innerHTML = `${d.getMonth()}/${d.getDay()}/${d.getYear()} ${d.getHours()}:${mm}:${ss}`;
11}
12
13setInterval(changeTime, 1000); //updates the time dynamically.
14
15//Group1
16//Click to Show functionality: group 1
17//clicks hide all divs, then uses a "title" attribute as a variable to toggle the associated box showing that title's information.
18//I am no marketer, so the text is some basic info I read on the websites.
19$(document).ready(function(){
20 $(".clickToShow").click(function(){
21 $(".clickToShowBlock").hide();
22 let idTag = '#' + this.getAttribute("title");
23 $(idTag).toggle();
24 });
25 });
26
27//Group 2
28//Same as above, except using hover instead of click to show the images.
29
30$(document).ready(function(){
31 $(".hoverToShow").hover(function(){let idTag = '#' + this.getAttribute("title");
32 $(idTag).show();
33 }, function(){let idTag = '#' + this.getAttribute("title");
34 $(idTag).hide();
35 $(".hoverToShowBlock").hide();
36 });
37 });
38
39 //Group3
40 //follows group 1 method, but loads all links at the same time by toggling a button.
41
42$(document).ready(function(){
43 $("#showLinksButton").click(function(){
44 $(".showLinks").toggle();
45 });
46 });
47
48 $(function(){
49 $("#showLinksButton").click(function () {
50 $(this).text(function(i, text){
51 return text === "Show Links" ? "Hide Links" : "Show Links";
52 })
53 });
54 })
55 //https://stackoverflow.com/questions/13652835/button-text-toggle-in-jquery
56
57 //Group4
58 //https://stackoverflow.com/questions/4511652/looping-through-list-items-with-jquery
59// http://jsfiddle.net/mblase75/wE4S8/
60//from: https://stackoverflow.com/questions/20105762/show-n-number-of-list-elements-at-a-time-jquery
61$(document).ready(function (){
62 var elements =$("#aviationLinks li");
63 var index=0;
64 var showTwo = function (index) {
65 if (index >=elements.length){
66 index = 0
67 }
68 elements.hide().slice(index, index+2).show();
69 setTimeout(function(){
70 showTwo(index +2)
71 }, 5000);
72 }
73 showTwo(0);
74 });
75
76//Make key-value pairs on id and hyperlinks
77const linkIDref = {
78 delphiInfo:"https://delphitechcorp.com/",
79 vrCityInfo:"https://vrcity.ca/",
80 auroraInfo:"https://auroraaerial.aero",
81 virbelaURL:"https://virbela.com",
82 amazonURL:"https://amazon.com",
83 moodleURL:"https://moodle.org",
84 xPlaneURL:"https://x-plane.com",
85 wordpressURL:"https://wordpress.org",
86 gitHub:"https://github.com",
87 googleMeet:"https://meet.google.com",
88 slack:"https://slack.com",
89 wrike:"https://wrike.com",
90 airbus:"https://airbus.com",
91 boeing:"https://boeing.com",
92 lockheedMartin:"https://lockheedmartin.com",
93 rtx:"https://rtx.com",
94 geAviation:"https://geaviation.com",
95 safran:"https://safran-group.com",
96 leonardo:"https://leonardocompany.com",
97 baseSystems:"https://baesystems.com"
98}
99//use key-values to populate the dynamic hyperlink functionality.
100jQuery(".link").click(function(){
101 $linkID = $(this).attr("id");
102 window.location.href=linkIDref[$linkID];
103})
104
105$( function() {
106 $( ".groups" ).draggable();
107 } );
108
109 $( function() {
110 $( ".groups" ).resizable();
111 } );body{
112 font-family: Arial, Helvetica, sans-serif;
113 font-size:1em;
114 background-color: skyblue;
115}
116h1{
117 text-align:center;
118}
119div{
120 border: black solid 2px;
121 border-radius:10px;
122}
123#main{
124 width:100%;
125 height: fit-content;
126 border:none;
127}
128#dashboard{
129 margin:auto auto auto auto;
130 display:grid;
131 border:none;
132 grid-template-columns: auto auto;
133 column-gap: 1em;
134 row-gap: 1em;
135 width:100%;
136 height:fit-content;
137}
138#dateTime{
139 margin:1em auto 1em auto;
140 border: black solid 2px;
141 width:fit-content;
142 height:fit-content;
143 padding:1em;
144 font-size: larger;
145 font-weight: bolder;
146 background-color: snow;
147}
148.groups{
149 position: relative;
150 margin:auto auto auto auto;
151 width:35em;
152 min-width: 32.5em;
153 background-color: snow;
154 padding:0px;
155 overflow: hidden;
156}
157.groups h2{
158 position:relative;
159 top:-0.9em;
160 text-align:center;
161 background-color: blue;
162 color:white;
163 cursor:move;
164}
165ul{
166 list-style-type: none;
167 position:relative;
168 top:-0.5em;
169}
170#group1{
171 height:10em;
172}
173#group2{
174 height:10em;
175}
176.clickToShowBlock{
177 cursor:pointer;
178 display:none;
179 position:absolute;
180 top: 3.5em;
181 left:12em;
182 height:fit-content;
183 width:20em;
184 border:none;
185}
186.hoverToShowBlock{
187 display:none;
188 position:absolute;
189 top: 4em;
190 left:12em;
191 height:fit-content;
192 width:20em;
193 border:none;
194}
195.hoverToShowBlock img{
196 max-height:6em;
197 max-width:19em;
198}
199dd{
200 padding: 0.5em 0em 0.5em 0em;
201}
202.showLinks{
203 display:none;
204}
205#showLinksButton{
206 position:absolute;
207 right:0.5em;
208 top:2em;
209 font-size:2em;
210}
211li:hover{
212 cursor:pointer;
213}
214
215dd:hover{
216 cursor:pointer;
217}
218@media screen and (max-width: 1200px)
219{
220 #dashboard{
221
222 grid-template-columns: auto;
223 }
224}<!DOCTYPE html>
225<html lang="en">
226 <head>
227 <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
228 <script src="https://code.jquery.com/ui/1.13.0/jquery-ui.js"></script>
229 <link rel="stylesheet" href="stylesheet2.css">
230 <meta charset="UTF-8" />
231 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
232 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
233 <title>Delphi Tech Corp Front-End Development Team Coding Test</title>
234 <script src="script2.js" defer></script>
235 </head>
236 <body>
237 <h1>TASK 2 Dashboard</h1>
238 <div id="main">
239 <div id = "dateTime"></div>
240 <div id = "dashboard">
241 <div id="group1" class = "groups">
242 <h2 id="group1h2">Group 1 - Alan Zheng's Companys + Products</h2>
243 <ul>
244 <li class="clickToShow" title = "vrCityInfo">VR City</li>
245 <li class="clickToShow" title = "delphiInfo">Delphi Tech Corp</li>
246 <li class="clickToShow" title = "auroraInfo">Aurora Aerial</li>
247 </ul>
248 <div id="vrCityInfo" class="clickToShowBlock link">
249 VR City is a virtual aviation training company. Our virtual community provides people with the learning tools to learn how to fly.
250 <br>
251 https://vrcity.ca/
252 </div>
253 <div id="delphiInfo" class="clickToShowBlock link">
254 Delphi Technology Corp is integrating new technologies such as augmented reality and virtuality into the aerospace and aviation industries!
255 <br>
256 https://delphitechcorp.com/
257 </div>
258 <div id="auroraInfo" class="clickToShowBlock link">
259 Aurora Aerial offers custom drone manufacturing. We develop both drone hardware and software.
260 <br>
261 https://auroraaerial.aero
262 </div>
263
264 </div>
265 <div id="group2" class = "groups">
266 <h2 id="group2h2">Group 2 - Technology products used at Delphi</h2>
267 <ul>
268 <li class="hoverToShow link" title= "virbela" id= "virbelaURL">Virbela</li>
269 <li class="hoverToShow link" title= "amazon" id= "amazonURL">Amazon</li>
270 <li class="hoverToShow link" title= "moodle" id= "moodleURL">Moodle</li>
271 <li class="hoverToShow link" title= "xPlane" id= "xPlaneURL">X-Plane</li>
272 <li class="hoverToShow link" title= "wordpress" id= "wordpressURL">Wordpress</li>
273 </ul>
274
275 <div id="virbela" class="hoverToShowBlock">
276 <img alt="Virbela" src="Logos/5fab9393da4ffe1e20d14cc6_virbela-logo-black-website.png">
277 </div>
278 <div id="amazon" class="hoverToShowBlock">
279 <img alt="Amazon" src="Logos/NicePng_amazon-png_197561.png">
280 </div>
281 <div id="moodle" class="hoverToShowBlock">
282 <img alt="Moodle" src="Logos/moodle_logo_small.svg">
283 </div>
284 <div id="xPlane" class="hoverToShowBlock">
285 <img alt="X-Plane" src="Logos/x-plane-logo.svg">
286 </div>
287 <div id="wordpress" class="hoverToShowBlock">
288 <img alt="Virbela" src="Logos/NicePng_wordpress-logo-png_395752.png">
289 </div>
290
291 </div>
292 <div id="group3" class = "groups">
293 <h2 id="group3h2">Group 3 - Websites used at Delphi</h2>
294 <ul>
295 <dt>GitHub</dt>
296 <dd class="showLinks link" id="gitHub">https://github.com</dd>
297 <dt>Google Meet</dt>
298 <dd class="showLinks link" id="googleMeet">https://meet.google.com</dd>
299 <dt>Slack</dt>
300 <dd class="showLinks link" id="slack">https://slack.com</dd>
301 <dt>Wrike</dt>
302 <dd class="showLinks link" id="wrike">https://wrike.com</dd>
303 </ul>
304 <button id="showLinksButton">Show Links</button>
305 </div>
306 <div id="group4" class = "groups">
307 <h2 id="group4h2">Group 4 - Aerospace Companies</h2>
308
309 <ul id="aviationLinks">
310 <li class = "cycle link" id="airbus">airbus.com</li>
311 <li class = "cycle link" id="boeing">boeing.com</li>
312 <li class = "cycle link" id="lockheedMartin">lockheedmartin.com</li>
313 <li class = "cycle link" id="rtx">rtx.com</li>
314 <li class = "cycle link" id="geAviation">geaviation.com</li>
315 <li class = "cycle link" id="safran">safran-group.com</li>
316 <li class = "cycle link" id="leonardo">leonardocompany.com</li>
317 <li class = "cycle link" id="baseSystems">baesystems.com</li>
318 </ul>
319 </div>
320 </div>
321 </div>
322 </body>
323</html><link rel="stylesheet" href="//code.jquery.com/ui/1.13.0/themes/base/jquery-ui.css">
324div:not(.ui-resizable-handle){
325
1$(function()){
2$( "resizable" ).resizable();
3});
4var $linkID, $linkURL
5
6function changeTime(){
7 let d= new Date(); //built in JS function
8 let mm = ('0' + d.getMinutes()).slice(-2);
9 let ss = ('0' + d.getSeconds()).slice(-2);
10 document.getElementById("dateTime").innerHTML = `${d.getMonth()}/${d.getDay()}/${d.getYear()} ${d.getHours()}:${mm}:${ss}`;
11}
12
13setInterval(changeTime, 1000); //updates the time dynamically.
14
15//Group1
16//Click to Show functionality: group 1
17//clicks hide all divs, then uses a "title" attribute as a variable to toggle the associated box showing that title's information.
18//I am no marketer, so the text is some basic info I read on the websites.
19$(document).ready(function(){
20 $(".clickToShow").click(function(){
21 $(".clickToShowBlock").hide();
22 let idTag = '#' + this.getAttribute("title");
23 $(idTag).toggle();
24 });
25 });
26
27//Group 2
28//Same as above, except using hover instead of click to show the images.
29
30$(document).ready(function(){
31 $(".hoverToShow").hover(function(){let idTag = '#' + this.getAttribute("title");
32 $(idTag).show();
33 }, function(){let idTag = '#' + this.getAttribute("title");
34 $(idTag).hide();
35 $(".hoverToShowBlock").hide();
36 });
37 });
38
39 //Group3
40 //follows group 1 method, but loads all links at the same time by toggling a button.
41
42$(document).ready(function(){
43 $("#showLinksButton").click(function(){
44 $(".showLinks").toggle();
45 });
46 });
47
48 $(function(){
49 $("#showLinksButton").click(function () {
50 $(this).text(function(i, text){
51 return text === "Show Links" ? "Hide Links" : "Show Links";
52 })
53 });
54 })
55 //https://stackoverflow.com/questions/13652835/button-text-toggle-in-jquery
56
57 //Group4
58 //https://stackoverflow.com/questions/4511652/looping-through-list-items-with-jquery
59// http://jsfiddle.net/mblase75/wE4S8/
60//from: https://stackoverflow.com/questions/20105762/show-n-number-of-list-elements-at-a-time-jquery
61$(document).ready(function (){
62 var elements =$("#aviationLinks li");
63 var index=0;
64 var showTwo = function (index) {
65 if (index >=elements.length){
66 index = 0
67 }
68 elements.hide().slice(index, index+2).show();
69 setTimeout(function(){
70 showTwo(index +2)
71 }, 5000);
72 }
73 showTwo(0);
74 });
75
76//Make key-value pairs on id and hyperlinks
77const linkIDref = {
78 delphiInfo:"https://delphitechcorp.com/",
79 vrCityInfo:"https://vrcity.ca/",
80 auroraInfo:"https://auroraaerial.aero",
81 virbelaURL:"https://virbela.com",
82 amazonURL:"https://amazon.com",
83 moodleURL:"https://moodle.org",
84 xPlaneURL:"https://x-plane.com",
85 wordpressURL:"https://wordpress.org",
86 gitHub:"https://github.com",
87 googleMeet:"https://meet.google.com",
88 slack:"https://slack.com",
89 wrike:"https://wrike.com",
90 airbus:"https://airbus.com",
91 boeing:"https://boeing.com",
92 lockheedMartin:"https://lockheedmartin.com",
93 rtx:"https://rtx.com",
94 geAviation:"https://geaviation.com",
95 safran:"https://safran-group.com",
96 leonardo:"https://leonardocompany.com",
97 baseSystems:"https://baesystems.com"
98}
99//use key-values to populate the dynamic hyperlink functionality.
100jQuery(".link").click(function(){
101 $linkID = $(this).attr("id");
102 window.location.href=linkIDref[$linkID];
103})
104
105$( function() {
106 $( ".groups" ).draggable();
107 } );
108
109 $( function() {
110 $( ".groups" ).resizable();
111 } );body{
112 font-family: Arial, Helvetica, sans-serif;
113 font-size:1em;
114 background-color: skyblue;
115}
116h1{
117 text-align:center;
118}
119div{
120 border: black solid 2px;
121 border-radius:10px;
122}
123#main{
124 width:100%;
125 height: fit-content;
126 border:none;
127}
128#dashboard{
129 margin:auto auto auto auto;
130 display:grid;
131 border:none;
132 grid-template-columns: auto auto;
133 column-gap: 1em;
134 row-gap: 1em;
135 width:100%;
136 height:fit-content;
137}
138#dateTime{
139 margin:1em auto 1em auto;
140 border: black solid 2px;
141 width:fit-content;
142 height:fit-content;
143 padding:1em;
144 font-size: larger;
145 font-weight: bolder;
146 background-color: snow;
147}
148.groups{
149 position: relative;
150 margin:auto auto auto auto;
151 width:35em;
152 min-width: 32.5em;
153 background-color: snow;
154 padding:0px;
155 overflow: hidden;
156}
157.groups h2{
158 position:relative;
159 top:-0.9em;
160 text-align:center;
161 background-color: blue;
162 color:white;
163 cursor:move;
164}
165ul{
166 list-style-type: none;
167 position:relative;
168 top:-0.5em;
169}
170#group1{
171 height:10em;
172}
173#group2{
174 height:10em;
175}
176.clickToShowBlock{
177 cursor:pointer;
178 display:none;
179 position:absolute;
180 top: 3.5em;
181 left:12em;
182 height:fit-content;
183 width:20em;
184 border:none;
185}
186.hoverToShowBlock{
187 display:none;
188 position:absolute;
189 top: 4em;
190 left:12em;
191 height:fit-content;
192 width:20em;
193 border:none;
194}
195.hoverToShowBlock img{
196 max-height:6em;
197 max-width:19em;
198}
199dd{
200 padding: 0.5em 0em 0.5em 0em;
201}
202.showLinks{
203 display:none;
204}
205#showLinksButton{
206 position:absolute;
207 right:0.5em;
208 top:2em;
209 font-size:2em;
210}
211li:hover{
212 cursor:pointer;
213}
214
215dd:hover{
216 cursor:pointer;
217}
218@media screen and (max-width: 1200px)
219{
220 #dashboard{
221
222 grid-template-columns: auto;
223 }
224}<!DOCTYPE html>
225<html lang="en">
226 <head>
227 <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
228 <script src="https://code.jquery.com/ui/1.13.0/jquery-ui.js"></script>
229 <link rel="stylesheet" href="stylesheet2.css">
230 <meta charset="UTF-8" />
231 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
232 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
233 <title>Delphi Tech Corp Front-End Development Team Coding Test</title>
234 <script src="script2.js" defer></script>
235 </head>
236 <body>
237 <h1>TASK 2 Dashboard</h1>
238 <div id="main">
239 <div id = "dateTime"></div>
240 <div id = "dashboard">
241 <div id="group1" class = "groups">
242 <h2 id="group1h2">Group 1 - Alan Zheng's Companys + Products</h2>
243 <ul>
244 <li class="clickToShow" title = "vrCityInfo">VR City</li>
245 <li class="clickToShow" title = "delphiInfo">Delphi Tech Corp</li>
246 <li class="clickToShow" title = "auroraInfo">Aurora Aerial</li>
247 </ul>
248 <div id="vrCityInfo" class="clickToShowBlock link">
249 VR City is a virtual aviation training company. Our virtual community provides people with the learning tools to learn how to fly.
250 <br>
251 https://vrcity.ca/
252 </div>
253 <div id="delphiInfo" class="clickToShowBlock link">
254 Delphi Technology Corp is integrating new technologies such as augmented reality and virtuality into the aerospace and aviation industries!
255 <br>
256 https://delphitechcorp.com/
257 </div>
258 <div id="auroraInfo" class="clickToShowBlock link">
259 Aurora Aerial offers custom drone manufacturing. We develop both drone hardware and software.
260 <br>
261 https://auroraaerial.aero
262 </div>
263
264 </div>
265 <div id="group2" class = "groups">
266 <h2 id="group2h2">Group 2 - Technology products used at Delphi</h2>
267 <ul>
268 <li class="hoverToShow link" title= "virbela" id= "virbelaURL">Virbela</li>
269 <li class="hoverToShow link" title= "amazon" id= "amazonURL">Amazon</li>
270 <li class="hoverToShow link" title= "moodle" id= "moodleURL">Moodle</li>
271 <li class="hoverToShow link" title= "xPlane" id= "xPlaneURL">X-Plane</li>
272 <li class="hoverToShow link" title= "wordpress" id= "wordpressURL">Wordpress</li>
273 </ul>
274
275 <div id="virbela" class="hoverToShowBlock">
276 <img alt="Virbela" src="Logos/5fab9393da4ffe1e20d14cc6_virbela-logo-black-website.png">
277 </div>
278 <div id="amazon" class="hoverToShowBlock">
279 <img alt="Amazon" src="Logos/NicePng_amazon-png_197561.png">
280 </div>
281 <div id="moodle" class="hoverToShowBlock">
282 <img alt="Moodle" src="Logos/moodle_logo_small.svg">
283 </div>
284 <div id="xPlane" class="hoverToShowBlock">
285 <img alt="X-Plane" src="Logos/x-plane-logo.svg">
286 </div>
287 <div id="wordpress" class="hoverToShowBlock">
288 <img alt="Virbela" src="Logos/NicePng_wordpress-logo-png_395752.png">
289 </div>
290
291 </div>
292 <div id="group3" class = "groups">
293 <h2 id="group3h2">Group 3 - Websites used at Delphi</h2>
294 <ul>
295 <dt>GitHub</dt>
296 <dd class="showLinks link" id="gitHub">https://github.com</dd>
297 <dt>Google Meet</dt>
298 <dd class="showLinks link" id="googleMeet">https://meet.google.com</dd>
299 <dt>Slack</dt>
300 <dd class="showLinks link" id="slack">https://slack.com</dd>
301 <dt>Wrike</dt>
302 <dd class="showLinks link" id="wrike">https://wrike.com</dd>
303 </ul>
304 <button id="showLinksButton">Show Links</button>
305 </div>
306 <div id="group4" class = "groups">
307 <h2 id="group4h2">Group 4 - Aerospace Companies</h2>
308
309 <ul id="aviationLinks">
310 <li class = "cycle link" id="airbus">airbus.com</li>
311 <li class = "cycle link" id="boeing">boeing.com</li>
312 <li class = "cycle link" id="lockheedMartin">lockheedmartin.com</li>
313 <li class = "cycle link" id="rtx">rtx.com</li>
314 <li class = "cycle link" id="geAviation">geaviation.com</li>
315 <li class = "cycle link" id="safran">safran-group.com</li>
316 <li class = "cycle link" id="leonardo">leonardocompany.com</li>
317 <li class = "cycle link" id="baseSystems">baesystems.com</li>
318 </ul>
319 </div>
320 </div>
321 </div>
322 </body>
323</html><link rel="stylesheet" href="//code.jquery.com/ui/1.13.0/themes/base/jquery-ui.css">
324div:not(.ui-resizable-handle){
325var $linkID, $linkURL
326
327function changeTime(){
328 let d= new Date(); //built in JS function
329 let mm = ('0' + d.getMinutes()).slice(-2);
330 let ss = ('0' + d.getSeconds()).slice(-2);
331 document.getElementById("dateTime").innerHTML = `${d.getMonth()}/${d.getDay()}/${d.getYear()} ${d.getHours()}:${mm}:${ss}`;
332}
333
334setInterval(changeTime, 1000); //updates the time dynamically.
335
336//Group1
337//Click to Show functionality: group 1
338//clicks hide all divs, then uses a "title" attribute as a variable to toggle the associated box showing that title's information.
339//I am no marketer, so the text is some basic info I read on the websites.
340$(document).ready(function(){
341 $(".clickToShow").click(function(){
342 $(".clickToShowBlock").hide();
343 let idTag = '#' + this.getAttribute("title");
344 $(idTag).toggle();
345 });
346 });
347
348//Group 2
349//Same as above, except using hover instead of click to show the images.
350
351$(document).ready(function(){
352 $(".hoverToShow").hover(function(){let idTag = '#' + this.getAttribute("title");
353 $(idTag).show();
354 }, function(){let idTag = '#' + this.getAttribute("title");
355 $(idTag).hide();
356 $(".hoverToShowBlock").hide();
357 });
358 });
359
360 //Group3
361 //follows group 1 method, but loads all links at the same time by toggling a button.
362
363$(document).ready(function(){
364 $("#showLinksButton").click(function(){
365 $(".showLinks").toggle();
366 });
367 });
368
369 $(function(){
370 $("#showLinksButton").click(function () {
371 $(this).text(function(i, text){
372 return text === "Show Links" ? "Hide Links" : "Show Links";
373 })
374 });
375 })
376 //https://stackoverflow.com/questions/13652835/button-text-toggle-in-jquery
377
378 //Group4
379 //https://stackoverflow.com/questions/4511652/looping-through-list-items-with-jquery
380// http://jsfiddle.net/mblase75/wE4S8/
381//from: https://stackoverflow.com/questions/20105762/show-n-number-of-list-elements-at-a-time-jquery
382$(document).ready(function (){
383 var elements =$("#aviationLinks li");
384 var index=0;
385 var showTwo = function (index) {
386 if (index >=elements.length){
387 index = 0
388 }
389 elements.hide().slice(index, index+2).show();
390 setTimeout(function(){
391 showTwo(index +2)
392 }, 5000);
393 }
394 showTwo(0);
395 });
396
397//Make key-value pairs on id and hyperlinks
398const linkIDref = {
399 delphiInfo:"https://delphitechcorp.com/",
400 vrCityInfo:"https://vrcity.ca/",
401 auroraInfo:"https://auroraaerial.aero",
402 virbelaURL:"https://virbela.com",
403 amazonURL:"https://amazon.com",
404 moodleURL:"https://moodle.org",
405 xPlaneURL:"https://x-plane.com",
406 wordpressURL:"https://wordpress.org",
407 gitHub:"https://github.com",
408 googleMeet:"https://meet.google.com",
409 slack:"https://slack.com",
410 wrike:"https://wrike.com",
411 airbus:"https://airbus.com",
412 boeing:"https://boeing.com",
413 lockheedMartin:"https://lockheedmartin.com",
414 rtx:"https://rtx.com",
415 geAviation:"https://geaviation.com",
416 safran:"https://safran-group.com",
417 leonardo:"https://leonardocompany.com",
418 baseSystems:"https://baesystems.com"
419}
420//use key-values to populate the dynamic hyperlink functionality.
421jQuery(".link").click(function(){
422 $linkID = $(this).attr("id");
423 window.location.href=linkIDref[$linkID];
424})
425
426$( function() {
427 $( ".groups" ).draggable();
428 } );
429
430 $( function() {
431 $( ".groups" ).resizable();
432 } );
1$(function()){
2$( "resizable" ).resizable();
3});
4var $linkID, $linkURL
5
6function changeTime(){
7 let d= new Date(); //built in JS function
8 let mm = ('0' + d.getMinutes()).slice(-2);
9 let ss = ('0' + d.getSeconds()).slice(-2);
10 document.getElementById("dateTime").innerHTML = `${d.getMonth()}/${d.getDay()}/${d.getYear()} ${d.getHours()}:${mm}:${ss}`;
11}
12
13setInterval(changeTime, 1000); //updates the time dynamically.
14
15//Group1
16//Click to Show functionality: group 1
17//clicks hide all divs, then uses a "title" attribute as a variable to toggle the associated box showing that title's information.
18//I am no marketer, so the text is some basic info I read on the websites.
19$(document).ready(function(){
20 $(".clickToShow").click(function(){
21 $(".clickToShowBlock").hide();
22 let idTag = '#' + this.getAttribute("title");
23 $(idTag).toggle();
24 });
25 });
26
27//Group 2
28//Same as above, except using hover instead of click to show the images.
29
30$(document).ready(function(){
31 $(".hoverToShow").hover(function(){let idTag = '#' + this.getAttribute("title");
32 $(idTag).show();
33 }, function(){let idTag = '#' + this.getAttribute("title");
34 $(idTag).hide();
35 $(".hoverToShowBlock").hide();
36 });
37 });
38
39 //Group3
40 //follows group 1 method, but loads all links at the same time by toggling a button.
41
42$(document).ready(function(){
43 $("#showLinksButton").click(function(){
44 $(".showLinks").toggle();
45 });
46 });
47
48 $(function(){
49 $("#showLinksButton").click(function () {
50 $(this).text(function(i, text){
51 return text === "Show Links" ? "Hide Links" : "Show Links";
52 })
53 });
54 })
55 //https://stackoverflow.com/questions/13652835/button-text-toggle-in-jquery
56
57 //Group4
58 //https://stackoverflow.com/questions/4511652/looping-through-list-items-with-jquery
59// http://jsfiddle.net/mblase75/wE4S8/
60//from: https://stackoverflow.com/questions/20105762/show-n-number-of-list-elements-at-a-time-jquery
61$(document).ready(function (){
62 var elements =$("#aviationLinks li");
63 var index=0;
64 var showTwo = function (index) {
65 if (index >=elements.length){
66 index = 0
67 }
68 elements.hide().slice(index, index+2).show();
69 setTimeout(function(){
70 showTwo(index +2)
71 }, 5000);
72 }
73 showTwo(0);
74 });
75
76//Make key-value pairs on id and hyperlinks
77const linkIDref = {
78 delphiInfo:"https://delphitechcorp.com/",
79 vrCityInfo:"https://vrcity.ca/",
80 auroraInfo:"https://auroraaerial.aero",
81 virbelaURL:"https://virbela.com",
82 amazonURL:"https://amazon.com",
83 moodleURL:"https://moodle.org",
84 xPlaneURL:"https://x-plane.com",
85 wordpressURL:"https://wordpress.org",
86 gitHub:"https://github.com",
87 googleMeet:"https://meet.google.com",
88 slack:"https://slack.com",
89 wrike:"https://wrike.com",
90 airbus:"https://airbus.com",
91 boeing:"https://boeing.com",
92 lockheedMartin:"https://lockheedmartin.com",
93 rtx:"https://rtx.com",
94 geAviation:"https://geaviation.com",
95 safran:"https://safran-group.com",
96 leonardo:"https://leonardocompany.com",
97 baseSystems:"https://baesystems.com"
98}
99//use key-values to populate the dynamic hyperlink functionality.
100jQuery(".link").click(function(){
101 $linkID = $(this).attr("id");
102 window.location.href=linkIDref[$linkID];
103})
104
105$( function() {
106 $( ".groups" ).draggable();
107 } );
108
109 $( function() {
110 $( ".groups" ).resizable();
111 } );body{
112 font-family: Arial, Helvetica, sans-serif;
113 font-size:1em;
114 background-color: skyblue;
115}
116h1{
117 text-align:center;
118}
119div{
120 border: black solid 2px;
121 border-radius:10px;
122}
123#main{
124 width:100%;
125 height: fit-content;
126 border:none;
127}
128#dashboard{
129 margin:auto auto auto auto;
130 display:grid;
131 border:none;
132 grid-template-columns: auto auto;
133 column-gap: 1em;
134 row-gap: 1em;
135 width:100%;
136 height:fit-content;
137}
138#dateTime{
139 margin:1em auto 1em auto;
140 border: black solid 2px;
141 width:fit-content;
142 height:fit-content;
143 padding:1em;
144 font-size: larger;
145 font-weight: bolder;
146 background-color: snow;
147}
148.groups{
149 position: relative;
150 margin:auto auto auto auto;
151 width:35em;
152 min-width: 32.5em;
153 background-color: snow;
154 padding:0px;
155 overflow: hidden;
156}
157.groups h2{
158 position:relative;
159 top:-0.9em;
160 text-align:center;
161 background-color: blue;
162 color:white;
163 cursor:move;
164}
165ul{
166 list-style-type: none;
167 position:relative;
168 top:-0.5em;
169}
170#group1{
171 height:10em;
172}
173#group2{
174 height:10em;
175}
176.clickToShowBlock{
177 cursor:pointer;
178 display:none;
179 position:absolute;
180 top: 3.5em;
181 left:12em;
182 height:fit-content;
183 width:20em;
184 border:none;
185}
186.hoverToShowBlock{
187 display:none;
188 position:absolute;
189 top: 4em;
190 left:12em;
191 height:fit-content;
192 width:20em;
193 border:none;
194}
195.hoverToShowBlock img{
196 max-height:6em;
197 max-width:19em;
198}
199dd{
200 padding: 0.5em 0em 0.5em 0em;
201}
202.showLinks{
203 display:none;
204}
205#showLinksButton{
206 position:absolute;
207 right:0.5em;
208 top:2em;
209 font-size:2em;
210}
211li:hover{
212 cursor:pointer;
213}
214
215dd:hover{
216 cursor:pointer;
217}
218@media screen and (max-width: 1200px)
219{
220 #dashboard{
221
222 grid-template-columns: auto;
223 }
224}<!DOCTYPE html>
225<html lang="en">
226 <head>
227 <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
228 <script src="https://code.jquery.com/ui/1.13.0/jquery-ui.js"></script>
229 <link rel="stylesheet" href="stylesheet2.css">
230 <meta charset="UTF-8" />
231 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
232 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
233 <title>Delphi Tech Corp Front-End Development Team Coding Test</title>
234 <script src="script2.js" defer></script>
235 </head>
236 <body>
237 <h1>TASK 2 Dashboard</h1>
238 <div id="main">
239 <div id = "dateTime"></div>
240 <div id = "dashboard">
241 <div id="group1" class = "groups">
242 <h2 id="group1h2">Group 1 - Alan Zheng's Companys + Products</h2>
243 <ul>
244 <li class="clickToShow" title = "vrCityInfo">VR City</li>
245 <li class="clickToShow" title = "delphiInfo">Delphi Tech Corp</li>
246 <li class="clickToShow" title = "auroraInfo">Aurora Aerial</li>
247 </ul>
248 <div id="vrCityInfo" class="clickToShowBlock link">
249 VR City is a virtual aviation training company. Our virtual community provides people with the learning tools to learn how to fly.
250 <br>
251 https://vrcity.ca/
252 </div>
253 <div id="delphiInfo" class="clickToShowBlock link">
254 Delphi Technology Corp is integrating new technologies such as augmented reality and virtuality into the aerospace and aviation industries!
255 <br>
256 https://delphitechcorp.com/
257 </div>
258 <div id="auroraInfo" class="clickToShowBlock link">
259 Aurora Aerial offers custom drone manufacturing. We develop both drone hardware and software.
260 <br>
261 https://auroraaerial.aero
262 </div>
263
264 </div>
265 <div id="group2" class = "groups">
266 <h2 id="group2h2">Group 2 - Technology products used at Delphi</h2>
267 <ul>
268 <li class="hoverToShow link" title= "virbela" id= "virbelaURL">Virbela</li>
269 <li class="hoverToShow link" title= "amazon" id= "amazonURL">Amazon</li>
270 <li class="hoverToShow link" title= "moodle" id= "moodleURL">Moodle</li>
271 <li class="hoverToShow link" title= "xPlane" id= "xPlaneURL">X-Plane</li>
272 <li class="hoverToShow link" title= "wordpress" id= "wordpressURL">Wordpress</li>
273 </ul>
274
275 <div id="virbela" class="hoverToShowBlock">
276 <img alt="Virbela" src="Logos/5fab9393da4ffe1e20d14cc6_virbela-logo-black-website.png">
277 </div>
278 <div id="amazon" class="hoverToShowBlock">
279 <img alt="Amazon" src="Logos/NicePng_amazon-png_197561.png">
280 </div>
281 <div id="moodle" class="hoverToShowBlock">
282 <img alt="Moodle" src="Logos/moodle_logo_small.svg">
283 </div>
284 <div id="xPlane" class="hoverToShowBlock">
285 <img alt="X-Plane" src="Logos/x-plane-logo.svg">
286 </div>
287 <div id="wordpress" class="hoverToShowBlock">
288 <img alt="Virbela" src="Logos/NicePng_wordpress-logo-png_395752.png">
289 </div>
290
291 </div>
292 <div id="group3" class = "groups">
293 <h2 id="group3h2">Group 3 - Websites used at Delphi</h2>
294 <ul>
295 <dt>GitHub</dt>
296 <dd class="showLinks link" id="gitHub">https://github.com</dd>
297 <dt>Google Meet</dt>
298 <dd class="showLinks link" id="googleMeet">https://meet.google.com</dd>
299 <dt>Slack</dt>
300 <dd class="showLinks link" id="slack">https://slack.com</dd>
301 <dt>Wrike</dt>
302 <dd class="showLinks link" id="wrike">https://wrike.com</dd>
303 </ul>
304 <button id="showLinksButton">Show Links</button>
305 </div>
306 <div id="group4" class = "groups">
307 <h2 id="group4h2">Group 4 - Aerospace Companies</h2>
308
309 <ul id="aviationLinks">
310 <li class = "cycle link" id="airbus">airbus.com</li>
311 <li class = "cycle link" id="boeing">boeing.com</li>
312 <li class = "cycle link" id="lockheedMartin">lockheedmartin.com</li>
313 <li class = "cycle link" id="rtx">rtx.com</li>
314 <li class = "cycle link" id="geAviation">geaviation.com</li>
315 <li class = "cycle link" id="safran">safran-group.com</li>
316 <li class = "cycle link" id="leonardo">leonardocompany.com</li>
317 <li class = "cycle link" id="baseSystems">baesystems.com</li>
318 </ul>
319 </div>
320 </div>
321 </div>
322 </body>
323</html><link rel="stylesheet" href="//code.jquery.com/ui/1.13.0/themes/base/jquery-ui.css">
324div:not(.ui-resizable-handle){
325var $linkID, $linkURL
326
327function changeTime(){
328 let d= new Date(); //built in JS function
329 let mm = ('0' + d.getMinutes()).slice(-2);
330 let ss = ('0' + d.getSeconds()).slice(-2);
331 document.getElementById("dateTime").innerHTML = `${d.getMonth()}/${d.getDay()}/${d.getYear()} ${d.getHours()}:${mm}:${ss}`;
332}
333
334setInterval(changeTime, 1000); //updates the time dynamically.
335
336//Group1
337//Click to Show functionality: group 1
338//clicks hide all divs, then uses a "title" attribute as a variable to toggle the associated box showing that title's information.
339//I am no marketer, so the text is some basic info I read on the websites.
340$(document).ready(function(){
341 $(".clickToShow").click(function(){
342 $(".clickToShowBlock").hide();
343 let idTag = '#' + this.getAttribute("title");
344 $(idTag).toggle();
345 });
346 });
347
348//Group 2
349//Same as above, except using hover instead of click to show the images.
350
351$(document).ready(function(){
352 $(".hoverToShow").hover(function(){let idTag = '#' + this.getAttribute("title");
353 $(idTag).show();
354 }, function(){let idTag = '#' + this.getAttribute("title");
355 $(idTag).hide();
356 $(".hoverToShowBlock").hide();
357 });
358 });
359
360 //Group3
361 //follows group 1 method, but loads all links at the same time by toggling a button.
362
363$(document).ready(function(){
364 $("#showLinksButton").click(function(){
365 $(".showLinks").toggle();
366 });
367 });
368
369 $(function(){
370 $("#showLinksButton").click(function () {
371 $(this).text(function(i, text){
372 return text === "Show Links" ? "Hide Links" : "Show Links";
373 })
374 });
375 })
376 //https://stackoverflow.com/questions/13652835/button-text-toggle-in-jquery
377
378 //Group4
379 //https://stackoverflow.com/questions/4511652/looping-through-list-items-with-jquery
380// http://jsfiddle.net/mblase75/wE4S8/
381//from: https://stackoverflow.com/questions/20105762/show-n-number-of-list-elements-at-a-time-jquery
382$(document).ready(function (){
383 var elements =$("#aviationLinks li");
384 var index=0;
385 var showTwo = function (index) {
386 if (index >=elements.length){
387 index = 0
388 }
389 elements.hide().slice(index, index+2).show();
390 setTimeout(function(){
391 showTwo(index +2)
392 }, 5000);
393 }
394 showTwo(0);
395 });
396
397//Make key-value pairs on id and hyperlinks
398const linkIDref = {
399 delphiInfo:"https://delphitechcorp.com/",
400 vrCityInfo:"https://vrcity.ca/",
401 auroraInfo:"https://auroraaerial.aero",
402 virbelaURL:"https://virbela.com",
403 amazonURL:"https://amazon.com",
404 moodleURL:"https://moodle.org",
405 xPlaneURL:"https://x-plane.com",
406 wordpressURL:"https://wordpress.org",
407 gitHub:"https://github.com",
408 googleMeet:"https://meet.google.com",
409 slack:"https://slack.com",
410 wrike:"https://wrike.com",
411 airbus:"https://airbus.com",
412 boeing:"https://boeing.com",
413 lockheedMartin:"https://lockheedmartin.com",
414 rtx:"https://rtx.com",
415 geAviation:"https://geaviation.com",
416 safran:"https://safran-group.com",
417 leonardo:"https://leonardocompany.com",
418 baseSystems:"https://baesystems.com"
419}
420//use key-values to populate the dynamic hyperlink functionality.
421jQuery(".link").click(function(){
422 $linkID = $(this).attr("id");
423 window.location.href=linkIDref[$linkID];
424})
425
426$( function() {
427 $( ".groups" ).draggable();
428 } );
429
430 $( function() {
431 $( ".groups" ).resizable();
432 } );body{
433 font-family: Arial, Helvetica, sans-serif;
434 font-size:1em;
435 background-color: skyblue;
436}
437h1{
438 text-align:center;
439}
440div:not(.ui-resizable-handle){ /* Added an exception to your generic rule */
441 border: black solid 2px;
442 border-radius:10px;
443}
444#main{
445 width:100%;
446 height: fit-content;
447 border:none;
448}
449#dashboard{
450 margin:auto auto auto auto;
451 display:grid;
452 border:none;
453 grid-template-columns: auto auto;
454 column-gap: 1em;
455 row-gap: 1em;
456 width:100%;
457 height:fit-content;
458}
459#dateTime{
460 margin:1em auto 1em auto;
461 border: black solid 2px;
462 width:fit-content;
463 height:fit-content;
464 padding:1em;
465 font-size: larger;
466 font-weight: bolder;
467 background-color: snow;
468}
469.groups{
470 position: relative;
471 margin:auto auto auto auto;
472 width:35em;
473 min-width: 32.5em;
474 background-color: snow;
475 padding:0px;
476 overflow: hidden;
477}
478.groups h2{
479 position:relative;
480 top:-0.9em;
481 text-align:center;
482 background-color: blue;
483 color:white;
484 cursor:move;
485}
486ul{
487 list-style-type: none;
488 position:relative;
489 top:-0.5em;
490}
491#group1{
492 height:10em;
493}
494#group2{
495 height:10em;
496}
497.clickToShowBlock{
498 cursor:pointer;
499 display:none;
500 position:absolute;
501 top: 3.5em;
502 left:12em;
503 height:fit-content;
504 width:20em;
505 border:none;
506}
507.hoverToShowBlock{
508 display:none;
509 position:absolute;
510 top: 4em;
511 left:12em;
512 height:fit-content;
513 width:20em;
514 border:none;
515}
516.hoverToShowBlock img{
517 max-height:6em;
518 max-width:19em;
519}
520dd{
521 padding: 0.5em 0em 0.5em 0em;
522}
523.showLinks{
524 display:none;
525}
526#showLinksButton{
527 position:absolute;
528 right:0.5em;
529 top:2em;
530 font-size:2em;
531}
532li:hover{
533 cursor:pointer;
534}
535
536dd:hover{
537 cursor:pointer;
538}
539@media screen and (max-width: 1200px)
540{
541 #dashboard{
542
543 grid-template-columns: auto;
544 }
545}
1$(function()){
2$( "resizable" ).resizable();
3});
4var $linkID, $linkURL
5
6function changeTime(){
7 let d= new Date(); //built in JS function
8 let mm = ('0' + d.getMinutes()).slice(-2);
9 let ss = ('0' + d.getSeconds()).slice(-2);
10 document.getElementById("dateTime").innerHTML = `${d.getMonth()}/${d.getDay()}/${d.getYear()} ${d.getHours()}:${mm}:${ss}`;
11}
12
13setInterval(changeTime, 1000); //updates the time dynamically.
14
15//Group1
16//Click to Show functionality: group 1
17//clicks hide all divs, then uses a "title" attribute as a variable to toggle the associated box showing that title's information.
18//I am no marketer, so the text is some basic info I read on the websites.
19$(document).ready(function(){
20 $(".clickToShow").click(function(){
21 $(".clickToShowBlock").hide();
22 let idTag = '#' + this.getAttribute("title");
23 $(idTag).toggle();
24 });
25 });
26
27//Group 2
28//Same as above, except using hover instead of click to show the images.
29
30$(document).ready(function(){
31 $(".hoverToShow").hover(function(){let idTag = '#' + this.getAttribute("title");
32 $(idTag).show();
33 }, function(){let idTag = '#' + this.getAttribute("title");
34 $(idTag).hide();
35 $(".hoverToShowBlock").hide();
36 });
37 });
38
39 //Group3
40 //follows group 1 method, but loads all links at the same time by toggling a button.
41
42$(document).ready(function(){
43 $("#showLinksButton").click(function(){
44 $(".showLinks").toggle();
45 });
46 });
47
48 $(function(){
49 $("#showLinksButton").click(function () {
50 $(this).text(function(i, text){
51 return text === "Show Links" ? "Hide Links" : "Show Links";
52 })
53 });
54 })
55 //https://stackoverflow.com/questions/13652835/button-text-toggle-in-jquery
56
57 //Group4
58 //https://stackoverflow.com/questions/4511652/looping-through-list-items-with-jquery
59// http://jsfiddle.net/mblase75/wE4S8/
60//from: https://stackoverflow.com/questions/20105762/show-n-number-of-list-elements-at-a-time-jquery
61$(document).ready(function (){
62 var elements =$("#aviationLinks li");
63 var index=0;
64 var showTwo = function (index) {
65 if (index >=elements.length){
66 index = 0
67 }
68 elements.hide().slice(index, index+2).show();
69 setTimeout(function(){
70 showTwo(index +2)
71 }, 5000);
72 }
73 showTwo(0);
74 });
75
76//Make key-value pairs on id and hyperlinks
77const linkIDref = {
78 delphiInfo:"https://delphitechcorp.com/",
79 vrCityInfo:"https://vrcity.ca/",
80 auroraInfo:"https://auroraaerial.aero",
81 virbelaURL:"https://virbela.com",
82 amazonURL:"https://amazon.com",
83 moodleURL:"https://moodle.org",
84 xPlaneURL:"https://x-plane.com",
85 wordpressURL:"https://wordpress.org",
86 gitHub:"https://github.com",
87 googleMeet:"https://meet.google.com",
88 slack:"https://slack.com",
89 wrike:"https://wrike.com",
90 airbus:"https://airbus.com",
91 boeing:"https://boeing.com",
92 lockheedMartin:"https://lockheedmartin.com",
93 rtx:"https://rtx.com",
94 geAviation:"https://geaviation.com",
95 safran:"https://safran-group.com",
96 leonardo:"https://leonardocompany.com",
97 baseSystems:"https://baesystems.com"
98}
99//use key-values to populate the dynamic hyperlink functionality.
100jQuery(".link").click(function(){
101 $linkID = $(this).attr("id");
102 window.location.href=linkIDref[$linkID];
103})
104
105$( function() {
106 $( ".groups" ).draggable();
107 } );
108
109 $( function() {
110 $( ".groups" ).resizable();
111 } );body{
112 font-family: Arial, Helvetica, sans-serif;
113 font-size:1em;
114 background-color: skyblue;
115}
116h1{
117 text-align:center;
118}
119div{
120 border: black solid 2px;
121 border-radius:10px;
122}
123#main{
124 width:100%;
125 height: fit-content;
126 border:none;
127}
128#dashboard{
129 margin:auto auto auto auto;
130 display:grid;
131 border:none;
132 grid-template-columns: auto auto;
133 column-gap: 1em;
134 row-gap: 1em;
135 width:100%;
136 height:fit-content;
137}
138#dateTime{
139 margin:1em auto 1em auto;
140 border: black solid 2px;
141 width:fit-content;
142 height:fit-content;
143 padding:1em;
144 font-size: larger;
145 font-weight: bolder;
146 background-color: snow;
147}
148.groups{
149 position: relative;
150 margin:auto auto auto auto;
151 width:35em;
152 min-width: 32.5em;
153 background-color: snow;
154 padding:0px;
155 overflow: hidden;
156}
157.groups h2{
158 position:relative;
159 top:-0.9em;
160 text-align:center;
161 background-color: blue;
162 color:white;
163 cursor:move;
164}
165ul{
166 list-style-type: none;
167 position:relative;
168 top:-0.5em;
169}
170#group1{
171 height:10em;
172}
173#group2{
174 height:10em;
175}
176.clickToShowBlock{
177 cursor:pointer;
178 display:none;
179 position:absolute;
180 top: 3.5em;
181 left:12em;
182 height:fit-content;
183 width:20em;
184 border:none;
185}
186.hoverToShowBlock{
187 display:none;
188 position:absolute;
189 top: 4em;
190 left:12em;
191 height:fit-content;
192 width:20em;
193 border:none;
194}
195.hoverToShowBlock img{
196 max-height:6em;
197 max-width:19em;
198}
199dd{
200 padding: 0.5em 0em 0.5em 0em;
201}
202.showLinks{
203 display:none;
204}
205#showLinksButton{
206 position:absolute;
207 right:0.5em;
208 top:2em;
209 font-size:2em;
210}
211li:hover{
212 cursor:pointer;
213}
214
215dd:hover{
216 cursor:pointer;
217}
218@media screen and (max-width: 1200px)
219{
220 #dashboard{
221
222 grid-template-columns: auto;
223 }
224}<!DOCTYPE html>
225<html lang="en">
226 <head>
227 <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
228 <script src="https://code.jquery.com/ui/1.13.0/jquery-ui.js"></script>
229 <link rel="stylesheet" href="stylesheet2.css">
230 <meta charset="UTF-8" />
231 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
232 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
233 <title>Delphi Tech Corp Front-End Development Team Coding Test</title>
234 <script src="script2.js" defer></script>
235 </head>
236 <body>
237 <h1>TASK 2 Dashboard</h1>
238 <div id="main">
239 <div id = "dateTime"></div>
240 <div id = "dashboard">
241 <div id="group1" class = "groups">
242 <h2 id="group1h2">Group 1 - Alan Zheng's Companys + Products</h2>
243 <ul>
244 <li class="clickToShow" title = "vrCityInfo">VR City</li>
245 <li class="clickToShow" title = "delphiInfo">Delphi Tech Corp</li>
246 <li class="clickToShow" title = "auroraInfo">Aurora Aerial</li>
247 </ul>
248 <div id="vrCityInfo" class="clickToShowBlock link">
249 VR City is a virtual aviation training company. Our virtual community provides people with the learning tools to learn how to fly.
250 <br>
251 https://vrcity.ca/
252 </div>
253 <div id="delphiInfo" class="clickToShowBlock link">
254 Delphi Technology Corp is integrating new technologies such as augmented reality and virtuality into the aerospace and aviation industries!
255 <br>
256 https://delphitechcorp.com/
257 </div>
258 <div id="auroraInfo" class="clickToShowBlock link">
259 Aurora Aerial offers custom drone manufacturing. We develop both drone hardware and software.
260 <br>
261 https://auroraaerial.aero
262 </div>
263
264 </div>
265 <div id="group2" class = "groups">
266 <h2 id="group2h2">Group 2 - Technology products used at Delphi</h2>
267 <ul>
268 <li class="hoverToShow link" title= "virbela" id= "virbelaURL">Virbela</li>
269 <li class="hoverToShow link" title= "amazon" id= "amazonURL">Amazon</li>
270 <li class="hoverToShow link" title= "moodle" id= "moodleURL">Moodle</li>
271 <li class="hoverToShow link" title= "xPlane" id= "xPlaneURL">X-Plane</li>
272 <li class="hoverToShow link" title= "wordpress" id= "wordpressURL">Wordpress</li>
273 </ul>
274
275 <div id="virbela" class="hoverToShowBlock">
276 <img alt="Virbela" src="Logos/5fab9393da4ffe1e20d14cc6_virbela-logo-black-website.png">
277 </div>
278 <div id="amazon" class="hoverToShowBlock">
279 <img alt="Amazon" src="Logos/NicePng_amazon-png_197561.png">
280 </div>
281 <div id="moodle" class="hoverToShowBlock">
282 <img alt="Moodle" src="Logos/moodle_logo_small.svg">
283 </div>
284 <div id="xPlane" class="hoverToShowBlock">
285 <img alt="X-Plane" src="Logos/x-plane-logo.svg">
286 </div>
287 <div id="wordpress" class="hoverToShowBlock">
288 <img alt="Virbela" src="Logos/NicePng_wordpress-logo-png_395752.png">
289 </div>
290
291 </div>
292 <div id="group3" class = "groups">
293 <h2 id="group3h2">Group 3 - Websites used at Delphi</h2>
294 <ul>
295 <dt>GitHub</dt>
296 <dd class="showLinks link" id="gitHub">https://github.com</dd>
297 <dt>Google Meet</dt>
298 <dd class="showLinks link" id="googleMeet">https://meet.google.com</dd>
299 <dt>Slack</dt>
300 <dd class="showLinks link" id="slack">https://slack.com</dd>
301 <dt>Wrike</dt>
302 <dd class="showLinks link" id="wrike">https://wrike.com</dd>
303 </ul>
304 <button id="showLinksButton">Show Links</button>
305 </div>
306 <div id="group4" class = "groups">
307 <h2 id="group4h2">Group 4 - Aerospace Companies</h2>
308
309 <ul id="aviationLinks">
310 <li class = "cycle link" id="airbus">airbus.com</li>
311 <li class = "cycle link" id="boeing">boeing.com</li>
312 <li class = "cycle link" id="lockheedMartin">lockheedmartin.com</li>
313 <li class = "cycle link" id="rtx">rtx.com</li>
314 <li class = "cycle link" id="geAviation">geaviation.com</li>
315 <li class = "cycle link" id="safran">safran-group.com</li>
316 <li class = "cycle link" id="leonardo">leonardocompany.com</li>
317 <li class = "cycle link" id="baseSystems">baesystems.com</li>
318 </ul>
319 </div>
320 </div>
321 </div>
322 </body>
323</html><link rel="stylesheet" href="//code.jquery.com/ui/1.13.0/themes/base/jquery-ui.css">
324div:not(.ui-resizable-handle){
325var $linkID, $linkURL
326
327function changeTime(){
328 let d= new Date(); //built in JS function
329 let mm = ('0' + d.getMinutes()).slice(-2);
330 let ss = ('0' + d.getSeconds()).slice(-2);
331 document.getElementById("dateTime").innerHTML = `${d.getMonth()}/${d.getDay()}/${d.getYear()} ${d.getHours()}:${mm}:${ss}`;
332}
333
334setInterval(changeTime, 1000); //updates the time dynamically.
335
336//Group1
337//Click to Show functionality: group 1
338//clicks hide all divs, then uses a "title" attribute as a variable to toggle the associated box showing that title's information.
339//I am no marketer, so the text is some basic info I read on the websites.
340$(document).ready(function(){
341 $(".clickToShow").click(function(){
342 $(".clickToShowBlock").hide();
343 let idTag = '#' + this.getAttribute("title");
344 $(idTag).toggle();
345 });
346 });
347
348//Group 2
349//Same as above, except using hover instead of click to show the images.
350
351$(document).ready(function(){
352 $(".hoverToShow").hover(function(){let idTag = '#' + this.getAttribute("title");
353 $(idTag).show();
354 }, function(){let idTag = '#' + this.getAttribute("title");
355 $(idTag).hide();
356 $(".hoverToShowBlock").hide();
357 });
358 });
359
360 //Group3
361 //follows group 1 method, but loads all links at the same time by toggling a button.
362
363$(document).ready(function(){
364 $("#showLinksButton").click(function(){
365 $(".showLinks").toggle();
366 });
367 });
368
369 $(function(){
370 $("#showLinksButton").click(function () {
371 $(this).text(function(i, text){
372 return text === "Show Links" ? "Hide Links" : "Show Links";
373 })
374 });
375 })
376 //https://stackoverflow.com/questions/13652835/button-text-toggle-in-jquery
377
378 //Group4
379 //https://stackoverflow.com/questions/4511652/looping-through-list-items-with-jquery
380// http://jsfiddle.net/mblase75/wE4S8/
381//from: https://stackoverflow.com/questions/20105762/show-n-number-of-list-elements-at-a-time-jquery
382$(document).ready(function (){
383 var elements =$("#aviationLinks li");
384 var index=0;
385 var showTwo = function (index) {
386 if (index >=elements.length){
387 index = 0
388 }
389 elements.hide().slice(index, index+2).show();
390 setTimeout(function(){
391 showTwo(index +2)
392 }, 5000);
393 }
394 showTwo(0);
395 });
396
397//Make key-value pairs on id and hyperlinks
398const linkIDref = {
399 delphiInfo:"https://delphitechcorp.com/",
400 vrCityInfo:"https://vrcity.ca/",
401 auroraInfo:"https://auroraaerial.aero",
402 virbelaURL:"https://virbela.com",
403 amazonURL:"https://amazon.com",
404 moodleURL:"https://moodle.org",
405 xPlaneURL:"https://x-plane.com",
406 wordpressURL:"https://wordpress.org",
407 gitHub:"https://github.com",
408 googleMeet:"https://meet.google.com",
409 slack:"https://slack.com",
410 wrike:"https://wrike.com",
411 airbus:"https://airbus.com",
412 boeing:"https://boeing.com",
413 lockheedMartin:"https://lockheedmartin.com",
414 rtx:"https://rtx.com",
415 geAviation:"https://geaviation.com",
416 safran:"https://safran-group.com",
417 leonardo:"https://leonardocompany.com",
418 baseSystems:"https://baesystems.com"
419}
420//use key-values to populate the dynamic hyperlink functionality.
421jQuery(".link").click(function(){
422 $linkID = $(this).attr("id");
423 window.location.href=linkIDref[$linkID];
424})
425
426$( function() {
427 $( ".groups" ).draggable();
428 } );
429
430 $( function() {
431 $( ".groups" ).resizable();
432 } );body{
433 font-family: Arial, Helvetica, sans-serif;
434 font-size:1em;
435 background-color: skyblue;
436}
437h1{
438 text-align:center;
439}
440div:not(.ui-resizable-handle){ /* Added an exception to your generic rule */
441 border: black solid 2px;
442 border-radius:10px;
443}
444#main{
445 width:100%;
446 height: fit-content;
447 border:none;
448}
449#dashboard{
450 margin:auto auto auto auto;
451 display:grid;
452 border:none;
453 grid-template-columns: auto auto;
454 column-gap: 1em;
455 row-gap: 1em;
456 width:100%;
457 height:fit-content;
458}
459#dateTime{
460 margin:1em auto 1em auto;
461 border: black solid 2px;
462 width:fit-content;
463 height:fit-content;
464 padding:1em;
465 font-size: larger;
466 font-weight: bolder;
467 background-color: snow;
468}
469.groups{
470 position: relative;
471 margin:auto auto auto auto;
472 width:35em;
473 min-width: 32.5em;
474 background-color: snow;
475 padding:0px;
476 overflow: hidden;
477}
478.groups h2{
479 position:relative;
480 top:-0.9em;
481 text-align:center;
482 background-color: blue;
483 color:white;
484 cursor:move;
485}
486ul{
487 list-style-type: none;
488 position:relative;
489 top:-0.5em;
490}
491#group1{
492 height:10em;
493}
494#group2{
495 height:10em;
496}
497.clickToShowBlock{
498 cursor:pointer;
499 display:none;
500 position:absolute;
501 top: 3.5em;
502 left:12em;
503 height:fit-content;
504 width:20em;
505 border:none;
506}
507.hoverToShowBlock{
508 display:none;
509 position:absolute;
510 top: 4em;
511 left:12em;
512 height:fit-content;
513 width:20em;
514 border:none;
515}
516.hoverToShowBlock img{
517 max-height:6em;
518 max-width:19em;
519}
520dd{
521 padding: 0.5em 0em 0.5em 0em;
522}
523.showLinks{
524 display:none;
525}
526#showLinksButton{
527 position:absolute;
528 right:0.5em;
529 top:2em;
530 font-size:2em;
531}
532li:hover{
533 cursor:pointer;
534}
535
536dd:hover{
537 cursor:pointer;
538}
539@media screen and (max-width: 1200px)
540{
541 #dashboard{
542
543 grid-template-columns: auto;
544 }
545}<!DOCTYPE html>
546<html lang="en">
547 <head>
548 <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
549 <script src="https://code.jquery.com/ui/1.13.0/jquery-ui.js"></script>
550 <link rel="stylesheet" href="//code.jquery.com/ui/1.13.0/themes/base/jquery-ui.css"><!-- Added the jQuery-ui CSS file -->
551 <link rel="stylesheet" href="stylesheet2.css">
552 <meta charset="UTF-8" />
553 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
554 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
555 <title>Delphi Tech Corp Front-End Development Team Coding Test</title>
556 <script src="script2.js" defer></script>
557 </head>
558 <body>
559 <h1>TASK 2 Dashboard</h1>
560 <div id="main">
561 <div id = "dateTime"></div>
562 <div id = "dashboard">
563 <div id="group1" class = "groups">
564 <h2 id="group1h2">Group 1 - Alan Zheng's Companys + Products</h2>
565 <ul>
566 <li class="clickToShow" title = "vrCityInfo">VR City</li>
567 <li class="clickToShow" title = "delphiInfo">Delphi Tech Corp</li>
568 <li class="clickToShow" title = "auroraInfo">Aurora Aerial</li>
569 </ul>
570 <div id="vrCityInfo" class="clickToShowBlock link">
571 VR City is a virtual aviation training company. Our virtual community provides people with the learning tools to learn how to fly.
572 <br>
573 https://vrcity.ca/
574 </div>
575 <div id="delphiInfo" class="clickToShowBlock link">
576 Delphi Technology Corp is integrating new technologies such as augmented reality and virtuality into the aerospace and aviation industries!
577 <br>
578 https://delphitechcorp.com/
579 </div>
580 <div id="auroraInfo" class="clickToShowBlock link">
581 Aurora Aerial offers custom drone manufacturing. We develop both drone hardware and software.
582 <br>
583 https://auroraaerial.aero
584 </div>
585
586 </div>
587 <div id="group2" class = "groups">
588 <h2 id="group2h2">Group 2 - Technology products used at Delphi</h2>
589 <ul>
590 <li class="hoverToShow link" title= "virbela" id= "virbelaURL">Virbela</li>
591 <li class="hoverToShow link" title= "amazon" id= "amazonURL">Amazon</li>
592 <li class="hoverToShow link" title= "moodle" id= "moodleURL">Moodle</li>
593 <li class="hoverToShow link" title= "xPlane" id= "xPlaneURL">X-Plane</li>
594 <li class="hoverToShow link" title= "wordpress" id= "wordpressURL">Wordpress</li>
595 </ul>
596
597 <div id="virbela" class="hoverToShowBlock">
598 <img alt="Virbela" src="Logos/5fab9393da4ffe1e20d14cc6_virbela-logo-black-website.png">
599 </div>
600 <div id="amazon" class="hoverToShowBlock">
601 <img alt="Amazon" src="Logos/NicePng_amazon-png_197561.png">
602 </div>
603 <div id="moodle" class="hoverToShowBlock">
604 <img alt="Moodle" src="Logos/moodle_logo_small.svg">
605 </div>
606 <div id="xPlane" class="hoverToShowBlock">
607 <img alt="X-Plane" src="Logos/x-plane-logo.svg">
608 </div>
609 <div id="wordpress" class="hoverToShowBlock">
610 <img alt="Virbela" src="Logos/NicePng_wordpress-logo-png_395752.png">
611 </div>
612
613 </div>
614 <div id="group3" class = "groups">
615 <h2 id="group3h2">Group 3 - Websites used at Delphi</h2>
616 <ul>
617 <dt>GitHub</dt>
618 <dd class="showLinks link" id="gitHub">https://github.com</dd>
619 <dt>Google Meet</dt>
620 <dd class="showLinks link" id="googleMeet">https://meet.google.com</dd>
621 <dt>Slack</dt>
622 <dd class="showLinks link" id="slack">https://slack.com</dd>
623 <dt>Wrike</dt>
624 <dd class="showLinks link" id="wrike">https://wrike.com</dd>
625 </ul>
626 <button id="showLinksButton">Show Links</button>
627 </div>
628 <div id="group4" class = "groups">
629 <h2 id="group4h2">Group 4 - Aerospace Companies</h2>
630
631 <ul id="aviationLinks">
632 <li class = "cycle link" id="airbus">airbus.com</li>
633 <li class = "cycle link" id="boeing">boeing.com</li>
634 <li class = "cycle link" id="lockheedMartin">lockheedmartin.com</li>
635 <li class = "cycle link" id="rtx">rtx.com</li>
636 <li class = "cycle link" id="geAviation">geaviation.com</li>
637 <li class = "cycle link" id="safran">safran-group.com</li>
638 <li class = "cycle link" id="leonardo">leonardocompany.com</li>
639 <li class = "cycle link" id="baseSystems">baesystems.com</li>
640 </ul>
641 </div>
642 </div>
643 </div>
644 </body>
645</html>
QUESTION
In which case the SLAM technique is used?
Asked 2022-Jan-04 at 07:26I am doing a study related to the field of augmented reality, and especially related to Google's ARCore technology. I would like to know if the SLAM method is required for model-based tracking. It seems obvious to me that it is not used in this case, but I could not find any article to confirm this. My second question is similar to the first one and is related to the Azure Spatial Anchors technology. This technology has the ability to recognize a scene that has been visualized during a previous session. In a way, the Azure Spatial Anchors technology reminds me a little bit of the model based tracking technology, knowing that the model based tracking has the ability to recognize a 3D object that has been previously recorded. So, in the same way I was wondering if the use of the Azure Spatial Anchors technology requires the use of the slam method ?
ANSWER
Answered 2022-Jan-04 at 01:42Have a look at Frequently asked questions about Azure Spatial Anchors
Azure Spatial Anchors depends on mixed reality / augmented reality trackers. These trackers perceive the environment with cameras and track the device in 6-degrees-of-freedom (6DoF) as it moves through the space.
Given a 6DoF tracker as a building block, Azure Spatial Anchors allows you to designate certain points of interest in your real environment as "anchor" points. You might, for example, use an anchor to render content at a specific place in the real-world.
When you create an anchor, the client SDK captures environment information around that point and transmits it to the service. If another device looks for the anchor in that same space, similar data transmits to the service. That data is matched against the environment data previously stored. The position of the anchor relative to the device is then sent back for use in the application.
...
For each point in the sparse point cloud, we transmit and store a hash of the visual characteristics of that point. The hash is derived from, but does not contain, any pixel data.
There is disclosure in Microsoft Research Blog that the same type of visual simultaneous localization and mapping (SLAM) algorithms are being used with Azure Spatial Anchors: Azure Spatial Anchors: How it works
For further details on the algorithm under NDA you can Open a tech support ticket.
QUESTION
Why does my video only play sound and no video with ARJS?
Asked 2021-Dec-13 at 14:28I'm building an Augmented Reality app with ARJS. I'm using an image as a marker and it seems to be working. The goal is to play a video when the image tracker detects the correct image, however, it plays only the audio and not the whole video.
index.html
1<!DOCTYPE html>
2<html lang="en">
3
4<head>
5 <meta charset="UTF-8">
6 <meta name="apple-mobile-web-app-capable" content="yes">
7 <link rel="stylesheet" href="css/styles.css">
8 <script src="./js/image-tracker/aframe-master.min.js"></script>
9 <script src="./js/image-tracker/aframe-ar-nft.js"></script>
10 <title>Test</title>
11 <script>
12 AFRAME.registerComponent('controller', {
13 init: function() {
14 this.toggle = false;
15 this.video = document.querySelector('#video');
16 this.video.pause();
17 },
18
19 tick: function() {
20 if (this.el.object3D.visible === true) {
21 if (!this.toggle) {
22 this.toggle = true;
23 this.video.play();
24 }
25 } else {
26 this.toggle = false;
27 this.video.pause();
28 }
29 }
30 })
31 </script>
32</head>
33
34<body>
35 <div class="arjs-loader">
36 <div>Loading, please wait...</div>
37 </div>
38 <a-scene
39 vr-mode-ui="enabled: false;"
40 renderer="logarithmicDepthBuffer: true;"
41 embedded
42 arjs="trackingMethod: best; sourceType: webcam;debugUIEnabled: false;"
43 >
44 <a-assets>
45 <video id="video" src="http://localhost:5000/assets/animation.mp4" webkit-playsinline playsinline></video>
46 </a-assets>
47
48 <a-nft
49 controller
50 type="nft"
51 url="./image_descriptors/car"
52 smooth="true"
53 smoothCount="10"
54 smoothTolerance="0.01"
55 smoothThreshold="5"
56 >
57 <a-video
58 width="1.75"
59 height="2"
60 position="200 0 -10"
61 rotation="0 90 0"
62 src="#video"
63 ></a-video>
64 </a-nft>
65 <a-entity camera></a-entity>
66 </a-scene>
67</body>
68</html>
69
ANSWER
Answered 2021-Dec-13 at 14:28There could be multiple reasons, here are some of them:
Make sure there are no console errors and the scene loads properly (your sandbox gave me
out of memory!!!
issues, also there were some CORS issues).Make sure that the video is placed on top of the marker. I'd use an oversized box (or the inspector) to find out where is the item, and adjust the position / scale.
I've made NFT descriptors with your car.jpg
resized to 1024x1024, and it seems to be working link to the forked sandbox with new descriptors :
QUESTION
How to fix AR connected issue in my device?
Asked 2021-Nov-23 at 13:58I am developing a website related to Augmented Reality. But my mobile phone (Samsung Galaxy M02S) is not supported AR. When I try to install ARcore, google play store show an error.
So I installed ARcore using apk and now this app was installed. After that, I checked my mobile phone AR was supported or not. The below notification was shown when I try to see AR.
How I fix this issue and have any other way to install ARcore into my phone?
ANSWER
Answered 2021-Nov-23 at 13:58AR Core requires some specific hardware to work. You can check the list of supported devices here. No amount of side loading will help because this is a hardware requirement issue. Moreover AR Core is under active development even if you somehow install a version that might work that version will soon be deprecated and you will start getting the popup saying you need to update.
Kindly use a device that is part of supported list or an Emulator that supports this. IMHO it is best to develop using a device that has support from AR Core team.
QUESTION
How to place a 3D model on top of a reference image with RealityKit?
Asked 2021-Nov-22 at 09:29I want to place a 3D Model from the local device on top of the reference image when it's recognized. To achieve this I have tried the following:
- Adding the reference image to the session configuration:
1override func viewDidLoad() {
2 super.viewDidLoad()
3
4 arView.session.delegate = self
5
6 // Check if the device supports the AR experience
7 if (!ARConfiguration.isSupported) {
8 TLogger.shared.error_objc("Device does not support Augmented Reality")
9 return
10 }
11
12 guard let qrCodeReferenceImage = UIImage(named: "QRCode") else { return }
13 let detectionImages: Set<ARReferenceImage> = convertToReferenceImages([qrCodeReferenceImage])
14
15 let configuration = ARWorldTrackingConfiguration()
16 configuration.detectionImages = detectionImages
17
18 arView.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
19}
20
- Using the
ARSessionDelegate
to get notified when the reference image was detected and placing the 3D model at the same position as hisARImageAnchor
:
1override func viewDidLoad() {
2 super.viewDidLoad()
3
4 arView.session.delegate = self
5
6 // Check if the device supports the AR experience
7 if (!ARConfiguration.isSupported) {
8 TLogger.shared.error_objc("Device does not support Augmented Reality")
9 return
10 }
11
12 guard let qrCodeReferenceImage = UIImage(named: "QRCode") else { return }
13 let detectionImages: Set<ARReferenceImage> = convertToReferenceImages([qrCodeReferenceImage])
14
15 let configuration = ARWorldTrackingConfiguration()
16 configuration.detectionImages = detectionImages
17
18 arView.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
19}
20func session(_ session: ARSession, didAdd anchors: [ARAnchor]) {
21 for anchor in anchors {
22 guard let imageAnchor = anchor as? ARImageAnchor else { return }
23 let position = imageAnchor.transform
24
25 addEntity(self.localModelPath!, position)
26 }
27}
28
1override func viewDidLoad() {
2 super.viewDidLoad()
3
4 arView.session.delegate = self
5
6 // Check if the device supports the AR experience
7 if (!ARConfiguration.isSupported) {
8 TLogger.shared.error_objc("Device does not support Augmented Reality")
9 return
10 }
11
12 guard let qrCodeReferenceImage = UIImage(named: "QRCode") else { return }
13 let detectionImages: Set<ARReferenceImage> = convertToReferenceImages([qrCodeReferenceImage])
14
15 let configuration = ARWorldTrackingConfiguration()
16 configuration.detectionImages = detectionImages
17
18 arView.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
19}
20func session(_ session: ARSession, didAdd anchors: [ARAnchor]) {
21 for anchor in anchors {
22 guard let imageAnchor = anchor as? ARImageAnchor else { return }
23 let position = imageAnchor.transform
24
25 addEntity(self.localModelPath!, position)
26 }
27}
28func addEntity(_ modelPath: URL, _ position: float4x4) {
29 // Load 3D Object as Entity
30 let entity = try! Entity.load(contentsOf: modelPath)
31
32 // Create the Anchor which gets added to the AR Scene
33 let anchor = AnchorEntity(world: position)
34 anchor.addChild(entity)
35 anchor.transform.matrix = position
36 arView.scene.addAnchor(anchor)
37}
38
However, whenever I try to place the anchor including my 3D model (the entity) at a specific position, it doesn't appear in the arView. It seems like the model is getting loaded though since a few frames are getting lost when executing the addEntity
function. When I don't specifically set the anchors position the model appears in front of the camera.
Can anyone lead me in the right direction here?
ANSWER
Answered 2021-Nov-20 at 18:44To make your code work properly, remove this line:
1override func viewDidLoad() {
2 super.viewDidLoad()
3
4 arView.session.delegate = self
5
6 // Check if the device supports the AR experience
7 if (!ARConfiguration.isSupported) {
8 TLogger.shared.error_objc("Device does not support Augmented Reality")
9 return
10 }
11
12 guard let qrCodeReferenceImage = UIImage(named: "QRCode") else { return }
13 let detectionImages: Set<ARReferenceImage> = convertToReferenceImages([qrCodeReferenceImage])
14
15 let configuration = ARWorldTrackingConfiguration()
16 configuration.detectionImages = detectionImages
17
18 arView.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
19}
20func session(_ session: ARSession, didAdd anchors: [ARAnchor]) {
21 for anchor in anchors {
22 guard let imageAnchor = anchor as? ARImageAnchor else { return }
23 let position = imageAnchor.transform
24
25 addEntity(self.localModelPath!, position)
26 }
27}
28func addEntity(_ modelPath: URL, _ position: float4x4) {
29 // Load 3D Object as Entity
30 let entity = try! Entity.load(contentsOf: modelPath)
31
32 // Create the Anchor which gets added to the AR Scene
33 let anchor = AnchorEntity(world: position)
34 anchor.addChild(entity)
35 anchor.transform.matrix = position
36 arView.scene.addAnchor(anchor)
37}
38anchor.transform.matrix = position
39
@TimLangner – "...But I want to make the model appear on top of the reference image and not at any other location..."
As you can see, my test sphere has appeared on top of the reference image. When changing its position, remember that the Y-axis of the image anchor is directed towards the camera if the QR is vertical, and is directed up if the QR code is on a horizontal surface.
Make sure, a pivot point is located where it should.
In my case (you can see that I'm using AppClipCode), to move sphere 30 cm up, I have to move along negative Z direction.
1override func viewDidLoad() {
2 super.viewDidLoad()
3
4 arView.session.delegate = self
5
6 // Check if the device supports the AR experience
7 if (!ARConfiguration.isSupported) {
8 TLogger.shared.error_objc("Device does not support Augmented Reality")
9 return
10 }
11
12 guard let qrCodeReferenceImage = UIImage(named: "QRCode") else { return }
13 let detectionImages: Set<ARReferenceImage> = convertToReferenceImages([qrCodeReferenceImage])
14
15 let configuration = ARWorldTrackingConfiguration()
16 configuration.detectionImages = detectionImages
17
18 arView.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
19}
20func session(_ session: ARSession, didAdd anchors: [ARAnchor]) {
21 for anchor in anchors {
22 guard let imageAnchor = anchor as? ARImageAnchor else { return }
23 let position = imageAnchor.transform
24
25 addEntity(self.localModelPath!, position)
26 }
27}
28func addEntity(_ modelPath: URL, _ position: float4x4) {
29 // Load 3D Object as Entity
30 let entity = try! Entity.load(contentsOf: modelPath)
31
32 // Create the Anchor which gets added to the AR Scene
33 let anchor = AnchorEntity(world: position)
34 anchor.addChild(entity)
35 anchor.transform.matrix = position
36 arView.scene.addAnchor(anchor)
37}
38anchor.transform.matrix = position
39entity.position.z = anchor.position.z - 0.3
40
In my opinion, the most simple and productive solution would be to use the RealityKit's native AnchorEntity(.image(...)), without the need of implementing ARImageAnchor
in delegate's method.
1override func viewDidLoad() {
2 super.viewDidLoad()
3
4 arView.session.delegate = self
5
6 // Check if the device supports the AR experience
7 if (!ARConfiguration.isSupported) {
8 TLogger.shared.error_objc("Device does not support Augmented Reality")
9 return
10 }
11
12 guard let qrCodeReferenceImage = UIImage(named: "QRCode") else { return }
13 let detectionImages: Set<ARReferenceImage> = convertToReferenceImages([qrCodeReferenceImage])
14
15 let configuration = ARWorldTrackingConfiguration()
16 configuration.detectionImages = detectionImages
17
18 arView.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
19}
20func session(_ session: ARSession, didAdd anchors: [ARAnchor]) {
21 for anchor in anchors {
22 guard let imageAnchor = anchor as? ARImageAnchor else { return }
23 let position = imageAnchor.transform
24
25 addEntity(self.localModelPath!, position)
26 }
27}
28func addEntity(_ modelPath: URL, _ position: float4x4) {
29 // Load 3D Object as Entity
30 let entity = try! Entity.load(contentsOf: modelPath)
31
32 // Create the Anchor which gets added to the AR Scene
33 let anchor = AnchorEntity(world: position)
34 anchor.addChild(entity)
35 anchor.transform.matrix = position
36 arView.scene.addAnchor(anchor)
37}
38anchor.transform.matrix = position
39entity.position.z = anchor.position.z - 0.3
40AnchorEntity(.image(group: "GroupName", name: "forModel"))
41
Here's a code:
1override func viewDidLoad() {
2 super.viewDidLoad()
3
4 arView.session.delegate = self
5
6 // Check if the device supports the AR experience
7 if (!ARConfiguration.isSupported) {
8 TLogger.shared.error_objc("Device does not support Augmented Reality")
9 return
10 }
11
12 guard let qrCodeReferenceImage = UIImage(named: "QRCode") else { return }
13 let detectionImages: Set<ARReferenceImage> = convertToReferenceImages([qrCodeReferenceImage])
14
15 let configuration = ARWorldTrackingConfiguration()
16 configuration.detectionImages = detectionImages
17
18 arView.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
19}
20func session(_ session: ARSession, didAdd anchors: [ARAnchor]) {
21 for anchor in anchors {
22 guard let imageAnchor = anchor as? ARImageAnchor else { return }
23 let position = imageAnchor.transform
24
25 addEntity(self.localModelPath!, position)
26 }
27}
28func addEntity(_ modelPath: URL, _ position: float4x4) {
29 // Load 3D Object as Entity
30 let entity = try! Entity.load(contentsOf: modelPath)
31
32 // Create the Anchor which gets added to the AR Scene
33 let anchor = AnchorEntity(world: position)
34 anchor.addChild(entity)
35 anchor.transform.matrix = position
36 arView.scene.addAnchor(anchor)
37}
38anchor.transform.matrix = position
39entity.position.z = anchor.position.z - 0.3
40AnchorEntity(.image(group: "GroupName", name: "forModel"))
41import UIKit
42import RealityKit
43
44class ViewController: UIViewController {
45
46 @IBOutlet var arView: ARView!
47
48 override func viewDidLoad() {
49 super.viewDidLoad()
50
51 let entity = ModelEntity(mesh: .generateSphere(radius: 0.1))
52 let anchor = AnchorEntity(.image(group: "AR Resources",
53 name: "appClipCode"))
54 anchor.addChild(entity)
55
56 entity.position.z = anchor.position.z - 0.3
57 arView.scene.anchors.append(anchor)
58 }
59}
60
QUESTION
ARKit does not recognize reference images
Asked 2021-Nov-16 at 09:58I'm trying to place a 3D model on top of a recognized image with ARKit and RealityKit - all programmatically. Before I start the ARView I'm downloading the model I want to show when the reference image is detected.
This is my current setup:
1override func viewDidLoad() {
2 super.viewDidLoad()
3
4 arView.session.delegate = self
5
6 // Check if the device supports the AR experience
7 if (!ARConfiguration.isSupported) {
8 TLogger.shared.error_objc("Device does not support Augmented Reality")
9 return
10 }
11
12 guard let qrCodeReferenceImage = UIImage(named: "QRCode") else { return }
13 let detectionImages: Set<ARReferenceImage> = convertToReferenceImages([qrCodeReferenceImage])
14
15 let configuration = ARWorldTrackingConfiguration()
16 configuration.detectionImages = detectionImages
17
18 arView.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
19}
20
I use the ARSessionDelegate to get notified when a new image anchor was added which means the reference image got detected:
1override func viewDidLoad() {
2 super.viewDidLoad()
3
4 arView.session.delegate = self
5
6 // Check if the device supports the AR experience
7 if (!ARConfiguration.isSupported) {
8 TLogger.shared.error_objc("Device does not support Augmented Reality")
9 return
10 }
11
12 guard let qrCodeReferenceImage = UIImage(named: "QRCode") else { return }
13 let detectionImages: Set<ARReferenceImage> = convertToReferenceImages([qrCodeReferenceImage])
14
15 let configuration = ARWorldTrackingConfiguration()
16 configuration.detectionImages = detectionImages
17
18 arView.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
19}
20func session(_ session: ARSession, didAdd anchors: [ARAnchor]) {
21 print("Hello")
22 for anchor in anchors {
23 guard let imageAnchor = anchor as? ARImageAnchor else { return }
24 let referenceImage = imageAnchor.referenceImage
25
26 addEntity(self.localModelPath!)
27 }
28}
29
However, the delegate method never gets called while other delegate functions like func session(ARSession, didUpdate: ARFrame)
are getting called so I assume that the session just doesn't detect the image. The image resolution is good and the printed image the big so it should definitely get recognized by the ARSession. I also checked that the image has been found before adding it to the configuration.
Can anyone lead me in the right direction here?
ANSWER
Answered 2021-Nov-16 at 09:58It looks like you have your configuration set up correctly. Your delegate-function should be called when the reference image is recognized. Make sure your configuration isn't overwritten at any point in your code.
Community Discussions contain sources that include Stack Exchange Network
Tutorials and Learning Resources in Augmented Reality
Tutorials and Learning Resources are not available at this moment for Augmented Reality